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(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函数打表,找规律)的更多相关文章
- Educational Codeforces Round 68 (Rated for Div. 2)---B
http://codeforces.com/contest/1194/problem/B /* */ # include <bits/stdc++.h> using namespace s ...
- Educational Codeforces Round 68 (Rated for Div. 2)补题
A. Remove a Progression 签到题,易知删去的为奇数,剩下的是正偶数数列. #include<iostream> using namespace std; int T; ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
随机推荐
- python调用c/c++ (入参出参为指针)
python可以使用ctypes库调用c++编译的so库函数 0x01 c/c++编译为so库文件 编译C文件 gcc -o libpycallfoo.so -shared -fPIC rsa.c ...
- 【做题笔记】洛谷P1002过河卒
虽说是 dp 入门题,但还是有很多细节需要注意 如果设 \(f_{x,y}\) 为目标地点为 \((x,y)\) 时走的种数,那么答案就是 \(f_{n,m}\) 在不考虑那只讨厌的马的情况下,对于任 ...
- HBase记录
本次记录是用于:SparkStreaming对接Kafka.HBase记录 一.基本概念 1.HBase以表的形式存储数据.表有行和列族组成.列族划分为若干个列.其结构如下 2.Row Key:行键 ...
- Python偶斐波那契数
斐波那契数列中的每一项都是前两项的和.由1和2开始生成的斐波那契数列前10项为 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … 考虑该斐波那契数列中不超过四百万的项,求其中为 ...
- JS高级---把局部变量变成全局变量
如何把局部变量变成全局变量? 把局部变量给window就可以了 函数的自调用---自调用函数 一次性的函数--声明的同时, 直接调用了 (function () { console.log(& ...
- GitHub网页版基本操作
创建存储库 登录GitHub进入主页,点击头像左边的加号,创建存储库 填写存储库名称.描述,根据需求设置其他选项.点击“Create repository”按钮 创建分支 打开之前创建好的存储库,点击 ...
- 移动端 输入框 input 被弹出来的键盘 挡住
给被挡住的input或者textarea加一个id,然后在click事件里调用下面的代码 document.querySelector('#xxx').scrollIntoView();
- 服务器安装mysql后配置远程访问权限
#登录mysql mysql -uroot -p: use mysql: #所有ip能访问 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED B ...
- SpringMVC_001 第一个SpringMVC程序
今天我们来学习第一个SpringMVC程序 一.配置开发方式 (1)首先建立一个SpringMVC web程序 (2)导入jar包 (3)建立UserController.java package ...
- [vue学习] 卡片展示分行功能简单实现
如图所示,实现简单的卡片展示分行功能. 分行功能较多地用于展示商品.相册等,本人在学习的过程中也是常常需要用到这个功能:虽然说现在有很多插件都能实现这个功能,但是自己写出来,能够理解原理,相信能够进步 ...