题解:P16885 [GKS 2022 #E] Coloring Game
__YiChaQAQ__o_O · · 题解
非常简单的一道题。
假设格子无限长。
第一步,机器人涂,将格子
因为格子
第二步,玩家涂,因为玩家要尽量的让机器人涂的格子少,并且机器人只会涂最左边能涂的格子,所以玩家可以涂第
不能涂格子
再让机器人涂的时候,机器人要涂最左边,也就是格子
代码如下:
#include<bits/stdc++.h>
using namespace std;
#define R read()
#define int long long
int R{
int re=0,fg=1;
char c;
while (1){
c=getchar();
if (('0'<=c and c<='9') or c=='-') break;
}
if (c=='-') c='0',fg=-1;
while (1){
re=re*10+c-'0';
c=getchar();
if (!(('0'<=c and c<='9') or c=='-')) break;
}
return re*fg;
}
signed main(){
int T=R;
for (int i=1;i<=T;i++){
double n=R;
cout<<"Case #"<<i<<": "<<ceil(n/5)<<"\n";//ceil(x) 表示对 x 向上取整
}
}