Codeforces Round #662 (Div. 2) 参与排名人数13194
[codeforces 1393A] Rainbow Dash, Fluttershy and Chess Coloring 题意不清让人恼火
总目录详见https://blog.csdn.net/mrcrack/article/details/103564004
在线测评地址https://codeforces.com/contest/1393/problem/A
Problem | Lang | Verdict | Time | Memory |
---|---|---|---|---|
A - Rainbow Dash, Fluttershy and Chess Coloring | GNU C++17 | Accepted | 31 ms | 3900 KB |
题目大意:(英文题目表述不清,没把题意说清。)给出 n×n 的棋盘,每回合可以选择一种颜色涂任意次,要求上色的块邻边是边界(这个点,英文题目中根本未体现)或是上一个已上色的块,求至少要多少个回合才能把这个正方形区域涂成蓝黄相间。
直到比赛中的第二次说明,才将问题说清。如下:
"The blocks are placed according to the following rule: each newly placed block must touch the built on the previous turns figure by a side (note that the outline borders of the grid are built initially)" mean s that Each newly placed block must touch one of the blocks from the previous STAGES (or the borders). 请注意,边界这时才出现。
基本思路:样例模拟如下
1.1表示第一次填色的第一步
1.2表示第一次填色的第二步
1.3表示第一次填色的第三步
......
2.1表示第二次填色的第一步
2.2表示第二次填色的第二步
2.3表示第二次填色的第三步
......
3.1表示第三次填色的第一步
3.2表示第三次填色的第二步
3.3表示第三次填色的第三步
......
n=1输出1 1=1/2+1
n=2输出2 2=2/2+1
n=3输出2 2=3/2+1
n=4输出3 3=4/2+1
n=5输出3 3=5/2+1
n=6输出4 4=6/2+1
AC代码如下:
#include
int main(){
int t,n;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
printf("%d\n",n/2+1);
}
return 0;
}