#include<bits/stdc++.h>
using namespace std;
int sg[1007];
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
if(k%3==0){
n%=(k+1);
if(n==k||n%3)
cout<<"Alice"<<"\n";
else
cout<<"Bob"<<"\n";
}
else{
if(n%3)
cout<<"Alice"<<"\n";
else
cout<<"Bob"<<"\n";
}
/*
cin>>n>>k;
sg[1]=1;
sg[2]=1;
sg[k]=1;
for(int i=3;i<=n;++i){
if(i>=k){
if(sg[i-1]==0||sg[i-2]==0||sg[i-k]==0)
sg[i]=1;
}
else{
if(sg[i-1]==0||sg[i-2]==0)
sg[i]=1;
}
}
for(int i=0;i<=n;++i){
cout<<sg[i]<<"\n";
}*/
//sg函数打表找规律,发现当k是3的倍数时,sg函数以k+1为循环节,当k不是3的倍数时,sg函数以3为循环节
}
return 0;
}

Educational Codeforces Round 68 (Rated for Div. 2)D(SG函数打表,找规律)的更多相关文章

  1. Educational Codeforces Round 68 (Rated for Div. 2)---B

    http://codeforces.com/contest/1194/problem/B /* */ # include <bits/stdc++.h> using namespace s ...

  2. Educational Codeforces Round 68 (Rated for Div. 2)补题

    A. Remove a Progression 签到题,易知删去的为奇数,剩下的是正偶数数列. #include<iostream> using namespace std; int T; ...

  3. Educational Codeforces Round 68 (Rated for Div. 2) C. From S To T (字符串处理)

    C. From S To T time limit per test1 second memory limit per test256 megabytes inputstandard input ou ...

  4. Educational Codeforces Round 68 (Rated for Div. 2) D. 1-2-K Game (博弈, sg函数,规律)

    D. 1-2-K Game time limit per test2 seconds memory limit per test256 megabytes inputstandard input ou ...

  5. Educational Codeforces Round 68 (Rated for Div. 2)-D. 1-2-K Game

    output standard output Alice and Bob play a game. There is a paper strip which is divided into n + 1 ...

  6. Educational Codeforces Round 68 (Rated for Div. 2)-C-From S To T

    You are given three strings ss, tt and pp consisting of lowercase Latin letters. You may perform any ...

  7. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  8. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  9. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

随机推荐

  1. python文件读取:遇见的错误及解决办法

    问题一: TypeError: 'str' object is not callable 产生原因: 该错误TypeError: 'str' object is not callable字面上意思:就 ...

  2. Java开发之Redis

    简介 Redis 是完全开源免费的,遵守 BSD 协议,是一个高性能的 key - value 数据库 Redis 与 其他 key - value 缓存产品均有以下特点: Redis 支持数据持久化 ...

  3. 【转载】Windows环境下JNI的实现实例

    转自:http://blog.csdn.net/jjunjoe/article/details/6987183 一.关于JNI: JNI(Java Native Interface):Java本地调用 ...

  4. 关于Ajax请求的JS封装函数

    每次连接ajax都要重复写很多代码,所以写了一个JS封装函数,如下: 再来解释一下其中obj对象的参数形式: obj={ 'type':提交方式,    get/post 'url' : 提交地址, ...

  5. FPGA-HPS

    最近在做DE1的图像方面实验,用到了HPS,所以简要谈一谈什么是HPS. 由图可知,DE1的板子就是有fpga+hps组成的: 参考自:http://bbs.eeworld.com.cn/thread ...

  6. 谈谈我对Promise的理解

    一.Promise是什么? Promise是最早由社区提出和实现的一种解决异步编程的方案,比其他传统的解决方案(回调函数和事件)更合理和更强大. ES6 将其写进了语言标准,统一了用法,原生提供了Pr ...

  7. AcWing 849. Dijkstra求最短路 I 朴素 邻接矩阵 稠密图

    //朴素Dijkstra 边权都是正数 稠密图:点和边差的比较多 #include<cstring> #include<iostream> #include<algori ...

  8. python 网页中文显示Unicode码

    print repr(a).decode("unicode–escape") 注:a是要输出的结果,

  9. Linux - seq

    1. 概述 生成序列的命令 之前貌似写过 seq 命令, 这次单独拉出来再写一次吧 节操先放一放 2. 命令 1. 帮助 命令 # 输出我就不打了, # 这个命令可用, 证明组件可用 > seq ...

  10. JavaScript 推箱子游戏

    推箱子游戏的 逻辑非常简单,但是如果不动手的话,还是不太清楚.我在这里讲一下自己的思路. 制作推箱子,首先要有自己的设计素材.如下我也是网上找的素材 第二步,理清游戏的规则. 游戏规则: 1.小人将箱 ...