#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. MySQL 的两种存储引擎

    MyISAM 是MySQL的默认数据库引擎(5.5以后默认是InnoDB)性能极佳,但不支持事务处理. InnoDB 是MySQL的数据库常用的数据引擎. MyISAM 和 InnoDB 两者之间有明 ...

  2. 2019牛客暑期多校训练营(第三场) J LRU management 模拟链表操作

    输入n, m,n表示n种操作,m表示最多可以容纳m个串. 第一种操作:先在容器里找是否存在这个串,如果不存在,则添加在末尾,这个串携带了一个值v. 如果存在,则先把之前存在的那个拿出来,然后在后面添加 ...

  3. PHP导出身份证号科学计数法

    最近在做PHP的数据导入和导出,到处身份证号的时候,直接变成了科学计算法,找了一个很简单的方法就是这样 $obj= " ".$v['idcard']; 但是这样有空格啊,网上搜了一 ...

  4. js 判断数组中是否包含某个元素

    vuex中结合使用v-if: 链接:https://www.cnblogs.com/hao-1234-1234/p/10980102.html

  5. 方便的 IcoMoon 图标字体

    官网地址:https://icomoon.io/app/#/select 已发现的方便之处: 1.官网已提供大量常用图标字体: 2.可通过 svg 将其转换为 图标字体: 3.不仅可转换,还可自定义编 ...

  6. python应用-使用python控制win2003服务器

    经调研和测试,服务端可通过ansible控制各linux服务器(容器),进行各类操作,且支持远程控制windows服务器,但windows操作系统中,需安装.net及powershell3.0及以上版 ...

  7. 安卓开发:打印Log

    在iOS开发中使用NSLog进行打印调试,在安卓中使用的是Log.v(tag, msg);等进行打印调试. 参考:[https://blog.csdn.net/salary/article/detai ...

  8. cookie的封装

    今天逛论坛,看到一个看起来写得好的函数,特此贴出分享: 原文地址[http://www.html-js.com/article/2638 ] 这个地址[https://github.com/jaywc ...

  9. falsk 使用celery后台执行任务

    # falsk 使用celery后台执行任务 1.基础环境搭建 doc:https://flask.palletsprojects.com/en/1.0.x/patterns/celery/ mkdi ...

  10. HDU2444 The Accomodation of Students(二分图最大匹配)

    有n个关系,他们之间某些人相互认识.这样的人有m对.你需要把人分成2组,使得每组人内部之间是相互不认识的.如果可以,就可以安排他们住宿了.安排住宿时,住在一个房间的两个人应该相互认识.最多的能有多少个 ...