output

standard output

Alice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one).

Players take turns, Alice is first. Each player during his or her turn has to move the chip 1, 2 or k cells to the left (so, if the chip is currently in the cell i, the player can move it into cell i - 1, i - 2 or i - k). The chip should not leave the borders of the paper strip: it is impossible, for example, to move it k cells to the left if the current cell has number i < k. The player who can't make a move loses the game.

Who wins if both participants play optimally?

Alice and Bob would like to play several games, so you should determine the winner in each game.

Input

The first line contains the single integer T (1 ≤ T ≤ 100) — the number of games. Next T lines contain one game per line. All games are independent.

Each of the next T lines contains two integers n and k (0 ≤ n ≤ 109, 3 ≤ k ≤ 109) — the length of the strip and the constant denoting the third move, respectively.

Output

For each game, print Alice if Alice wins this game and Bob otherwise.

Example
input

Copy
  1. 4
    0 3
    3 3
    3 4
    4 4
output

Copy
  1. Bob
    Alice
    Bob
    Alice

代码:

  1. #include<cstdio>
  2. #include<iostream>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<queue>
  6. #include<stack>
  7. #include<set>
  8. #include<vector>
  9. #include<map>
  10. #include<cmath>
  11. const int maxn=1e5+;
  12. typedef long long ll;
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17. int T;
  18. scanf("%d", &T);
  19. while (T--)
  20. {
  21. int n, k;
  22. scanf("%d%d", &n, &k);
  23. if (k == )
  24. {
  25. if(n%!=)
  26. {
  27. puts("Alice\n");
  28. }
  29. else
  30. {
  31. puts("Bob");
  32. }
  33.  
  34. }
  35. else if (k % == )
  36. {
  37. n %= (k + );
  38. if (n % == && n != k)
  39. puts("Bob");
  40. else
  41. puts("Alice");
  42. }
  43. else
  44. {
  45. if(n%!=)
  46. {
  47. puts("Alice\n");
  48. }
  49. else
  50. {
  51. puts("Bob");
  52. }
  53. }
  54. }
  55. }

Educational Codeforces Round 68 (Rated for Div. 2)-D. 1-2-K Game的更多相关文章

  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(SG函数打表,找规律)

    #include<bits/stdc++.h>using namespace std;int sg[1007];int main(){ int t; cin>>t; while ...

  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. 8月1日起全部无版号游戏下架,ios手游想上架看这里!

      在苹果至中国游戏开发者的邮件中声明:如果开发者不能在7月31日前提交版号及相关文件,付费游戏将不可以在中国AppStore供应.也就是说:   从8月1日开始,苹果将正式下架全部.所有的ios付费 ...

  2. Ubuntu环境下使用Jupyter Notebook查找桌面.csv文档的方法

    这个问题困扰了我很久,最后在一个老师发来的完成结果里找到了答案.(奇怪的是教材里没有.老师也不讲.尤其是百度也没有啊啊啊啊) 好了进入正题.教材里的原话是这样的 这行代码实现的环境应该是在window ...

  3. 18、Memento 备忘录模式

    例如:用于记录快照(顺势状态).存盘 1.Memento Memento设计模式是一种软件设计模式,用于将对象回滚到其先前状态.它是行为设计模式的一部分,与算法和对象之间的职责分配有关. 行为模式描述 ...

  4. Good-turning估计

    在学习NLP过程中,遇到了Good-turning的介绍,网上找了相关的资料查看,总结如下. 思想: 其主要思想是从概率的总量中分配少量的比例给零概率项. 思路: 假定给定的语料库中出现 \(r\)次 ...

  5. gotoblas,mpich,hpl,hpcg的安装

    gotoblas的安装 mpich 安装 tar zxvf mpich-3.2.1.tar.gz cd mpich-3.2 ./configure --prefix=/usr/local/mpich( ...

  6. artifactdescriptorexception:Failed to read artifact descriptor for xxx:jar ”

    在Eclipse中执行Maven的install命令时,报“Failed to read artifact descriptor for xxx:jar ”的错误.这可能是在下载过程中文件出现错误.或 ...

  7. JS学习第六天

    匿名函数: 定义:function(参数列表){ 要执行的语句块: } 定义名(): 创建日期对象:Date var date=new Date(); alert(date);  不输入则是默认月,日 ...

  8. Flutter 容器(7) - DecoratedBox

    DecoratedBox: 装饰容器,在其子widget绘制前(或后)绘制一个装饰Decoration(如背景.边框.渐变等) import 'package:flutter/material.dar ...

  9. SSRF 跨站请求伪造学习笔记

    参考文章: 了解SSRF,这一篇就足够了 SSRF 学习之路 SSRF绕过方法总结 Weblogic SSRF漏洞 What-是什么 SSRF(Server-Side Request Forgery) ...

  10. 在GitHub上删除仓库 or 项目,基操!!

    创建错误或者想要抛弃某个仓库or项目,点击选择项目,选择Setting页面,左侧方框Option页拉到底: 你就可以看到一个红色的危险域,called Danger Zone,这不禁让我想到了黑子篮球 ...