HDOJ 2053 Switch Game】的更多相关文章

Problem Description There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to…
Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10200    Accepted Submission(s): 6175 Problem Description There are many lamps in a line. All of them are off at first. A series of op…
http://acm.hdu.edu.cn/showproblem.php?pid=2053 Problem Description There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2053 题目大意:灯开始是关着的,有n盏灯,i从1数到n每当灯的序号是i的倍数的时候就对灯进行一次操作(开->关,关->开),求最后第n盏灯是关着还是开着. 解题思路:直接对第n盏灯模拟也可以,但是有规律更好不是吗~.其实就是判断n的约束奇偶性,奇数就开着,偶数就关着. 当一个数不是完全平方数:如18约数为:(3,6),(2,19),(1,15)约数个数总会是偶数,因为每个约数都有一个对应的不同的约…
Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13113    Accepted Submission(s): 7970 Problem Description There are many lamps in a line. All of them are off at first. A series of o…
2047  阿牛的EOF牛肉串 #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d",&n)){ s[]=;s[]=; ;i<=n;i++){ s[i] = s[i-]* + s[i-]*; } printf("%I64d\n",s[n]); } } 2048  神.上帝以及老天爷 #include<stdio.h> int main(){ in…
(string process, fgets, scanf, neat utilization of switch clause) simple problem, simple code. #include <cstdio> #include <algorithm> #define MAXLEN 22 char password[MAXLEN]; int main() { //freopen("input.txt","r",stdin); i…
as Scott Meyers said in his book Effective STL, "My advice on choosing among the sorting algorithms is to make your selection based on what you need to accomplish, not on performance considerations. If you choose an algorithm that does only what you…
bit masking is very common on the lower level code. #include <cstdio> #include <algorithm> #define MAXSIZE 205 char line[MAXSIZE]; int main() { //freopen("input.txt","r",stdin); int x,y, dir; // (dir&3) 0,1,2,3 -- right…
#include <iostream> #include <string> #include <vector> using namespace std; /* 无穷多次操作,第n灯的状态 */ int main() { long long n; while (cin >> n) { ; ; i <= n; i++) { ) { count++; } } == ) { cout << << endl; } else { cout…