#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. eclipse报错:unable to install breakpoint in .......due to missing line number attributes

    报错信息如下: 解决方案方案1.把断点都干掉,再启动.应该是代码更新后,断点位置没有代码了或位置改变了. 方案2.在Eclipse - Preferences - Java - Complier 下  ...

  2. 条件锁condition与Queue()

    在学习之前你应该先了解锁和队列基础 import queue import time import random import threading import asyncio import logg ...

  3. python 实现 md文档自动编号

    目录 1. 原理 2. 运行方法 3. 效果 4. 代码 1. 原理 正则匹配对相应字符串进行替换 2. 运行方法 python md_convert.py [a.md, b.md,...] # 转换 ...

  4. ACM-ICPC实验室20.2.21测试-图论(二)

    A.患者的编号 给出一个有向图,要求你输出字典序最小的拓扑排序. 常规拓扑排序是做不了的,正解是反向建图,同时用大根堆的优先队列维护,保证每次优先访问编号大的结点,再反向输出~ #include< ...

  5. 转载:AAC编解码概述

    转自:http://www.cnblogs.com/gaozehua/archive/2012/05/03/2479960.html 编码概述 其整体AAC 编解码系统,如图所示,其编码流程概述如下: ...

  6. HTML5学习(7)多媒体元素

    视频元素video <video src="./media/xxx.mp4" controls autoplay muted loop></video> 音 ...

  7. UVA 12124 Assemble(二分答案)

    题目链接:https://vjudge.net/problem/UVA-12124 垃圾vjudge毁我青春!! 首先这道题是解决“最小值最大”的问题,所以要二分答案. 在这里我们二分$quality ...

  8. 题解 CF546B Soldier and Badges

    CF546B Soldier and Badges 简单的贪心qwq 排个序,如果当前数与之前的数相重,已经用过,则加到一个之前没有用过的数 #include<cstdio> #inclu ...

  9. GO学习之 从hello.go开始

    一.GO运行的两种方式 1.如果是对源码编译后,再执行 如:hello.go文件 hello.go文件(源文件)----go build hello.go[编译文件]--->变成可执行文件(.e ...

  10. Flask 学习之 路由

    一.路由的基本定义 # 指定访问路径为 demo1 @app.route('/demo1') def demo1(): return 'demo1' 二.常用路由设置方式 @app.route('/u ...