51Nod 1185 威佐夫游戏 V2
第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000)
第2 - T + 1行:每行2个数分别是2堆石子的数量,中间用空格分隔。(1 <= N <= 10^18)
共T行,如果A获胜输出A,如果B获胜输出B。
3
3 5
3 4
1 9
B
A
A
//Asimple
#include <bits/stdc++.h>
//#define INF 0x3fffffff
#define swap(a,b,t) t = a, a = b, b = t
#define CLS(a, v) memset(a, v, sizeof(a))
#define debug(a) cout << #a << " = " << a <<endl
#define test() cout<<"=========="<<endl
using namespace std;
typedef long long ll;
const int maxn = +;
const double PI=acos(-1.0);
const ll mod = ;
const int INF = ( << ) ;
const int dx[] = {-, , , };
const int dy[] = { ,-, , };
ll n, m, res, ans, len, T, k, num, sum, t;
ll te[] = {,,};
//ll mod; void input() {
ios_base::sync_with_stdio(false);
cin >> T;
while( T -- ){
cin >> n >> m;
if( n>m ) { t = n; n = m; m = t; }
res = m-n;
k = res/mod, t = res%mod;
sum = t*te[];
sum = k*te[]+t*te[]+sum/mod;
sum = k*te[]+t*te[]+sum/mod;
sum = res+k*te[] + sum/mod;
if( sum == n ) cout << "B" << endl;
else cout << "A" << endl;
}
} int main(){
input();
return ;
}
51Nod 1185 威佐夫游戏 V2的更多相关文章
- 51NOD 1185 威佐夫游戏 V2(威佐夫博弈)
1185 威佐夫游戏 V2 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取 ...
- (博弈论 高精度小数)51NOD 1185 威佐夫游戏 V2
有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...
- 51nod--1185 威佐夫游戏 V2 (博弈, 乘法模拟)
题目: 1185 威佐夫游戏 V2 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中 ...
- 51nod1185 威佐夫游戏 V2 (模拟乘法)
1185 威佐夫游戏 V2 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取 ...
- 51nod1185 威佐夫游戏 V2【博弈论】
有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...
- 51Nod 1072 威佐夫游戏
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1072 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆 ...
- (博弈论)51NOD 1072 威佐夫游戏
有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...
- 51Nod 1072:威佐夫游戏 (威佐夫博奕)
1072 威佐夫游戏 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数 ...
- 51nod--1072 威佐夫游戏 (博弈论)
题目: 1072 威佐夫游戏 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同 ...
随机推荐
- LeetCode - 498. Diagonal Traverse
Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal ...
- iOS WebView中视频横屏播放返回导航栏在状态栏下面
iOS9以上系统横屏播放UIWebView中的视频返回后会出现以下问题:1.如图,UIWebView中包含一个视频: 1 2.播放web内容中的视频,并横屏观看: 2 3.直接在横屏状态下返回 ...
- namecheap 添加二级域名
namecheap Docs Nginx 添加一个server server { listen 80; server_name video.ajanuw.fun; location / { root ...
- 使用 intro.js 库
使用 render() { const reducer = this.props.testReducer; return ( <React.Fragment> <button dat ...
- hibernate12--缓存
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN&q ...
- Java8 中的 default
之前的版本里 interface 中的方法必须是抽象方法,不能有方法体.现在可以添加 interface 内方法,只需要在方法的前面加一个 default 关键字,表示属于接口内部默认存在的方法. 如 ...
- date格式互转
+"%Y/%m/%d-%H:%M:%S" date -d "2017/11/21 17:02:09" +%s
- mysql批量update的两种方法
today a question let me happy(抓狂) 头儿分了一个小任务,让修改循环调用dao层的那些不啦不啦不啦,鉴于之前写过批量更新的玩意,so 很快代码就修改完了,but 测的时候 ...
- Java 批量下载excel,并对excel赋值,压缩为zip文件(POI版)
package com.neusoft.nda.servlet; import java.io.File;import java.io.FileInputStream;import java.io.F ...
- 泡泡一分钟:Semantic Labeling of Indoor Environments from 3D RGB Maps
张宁 Semantic Labeling of Indoor Environments from 3D RGB Maps Manuel Brucker, Maximilian Durner, Ra ...