标签:color 分享 ext http span icon fine problem online
1072 威佐夫游戏51NOD基础题
第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000) 第2 - T + 1行:每行2个数分别是2堆石子的数量,中间用空格分隔。(1 <= N <= 2000000)
共T行,如果A获胜输出A,如果B获胜输出B。
3 3 5 3 4 1 9
B A A
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std ; #define LL long long void swap( LL &a1 ,LL &a2){ LL temp = a1 ; a1 = a2 ; a2 = temp ; } int main(){ LL a , b ; int t ; scanf("%d" , &t) ; while(t--){ scanf("%lld%lld" , &a , &b) ; if(a > b) swap(a , b ) ; double re = (1 + sqrt(5))/2 ;// 黄金分割 //if((LL)(re*(b-a)) == a )//都行 if(floor(re*(b-a)) == a) { printf("B\n") ; } else { printf("A\n") ; } } return 0 ; }
标签:color 分享 ext http span icon fine problem online
原文地址:http://www.cnblogs.com/yi-ye-zhi-qiu/p/7631241.html