poj 1218 THE DRUNK JAILER】的更多相关文章

THE DRUNK JAILER Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25124   Accepted: 15767 Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked…
THE DRUNK JAILER Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 23358   Accepted: 14720 Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked…
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/sr19930829/article/details/37727417 THE DRUNK JAILER Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 23246   Accepted: 14641 Description A certain prison contains a long hall of n cells, e…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188 题目大意:n为5-100之间的一个数,代表有多少间牢房,刚开始所有房间打开,第一轮2的倍数的房间(打开的关上,关上的打开),第二轮3的倍数,第四轮4的倍数......n轮,最后有几间牢房打开的 . 解题思路:开灯问题,跟HDU 2053差不多,只要牢房编号是完全平方数,那囚犯就可以逃出去.这里有解释:http://www.cnblogs.com/fu3638/p/7507239.html sq…
THE DRUNK JAILER Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24918   Accepted: 15632 Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked…
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1337 杭电 http://poj.org/problem?id=1218清华 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1350浙江 原本以为小小的一道水题不值得去总结,但是发现却有好多方法,好神奇啊 方法一:数据挺小的模拟就好 #include<iostream> #include<algorithm> #…
http://poj.org/problem?id=1218 题意:门的状态有两种开或关,初始化为开,每次进行状态转换,第一次把门号是1的倍数的门状态转换,第二次把门号是2的倍数的门状态转换,......,第n次把状态是n的倍数的门状态转换,输出最后有几个门是开的状态. #include<stdio.h> #include<string.h> int main() { ],n; scanf("%d",&t); while(t--) { scanf(&qu…
Problem A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked. One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink o…
一.Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked. One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a d…
这是一道很简单的题目,题目大概意思说下:就是有n个监狱(编号从1到n),第一次全部打开,第二次打开编号为2的倍数的,第三次打开编号为3的倍数的,以此类推...最后问你有几个监狱是打开的 题目中我使用了memset函数来为数组初始化,发现了自己一个以前疏忽的地方 1.void * memset(void*,int,size_t) 这里的size需要注意是以字节为单位,所以当你为个数为n的整型数组赋初值时要这样写memset(name,1,n*sizeof(int)); 2.memset在头文件st…