HDU_2053 Switch Game
来源:互联网 发布:web portal认证软件 编辑:程序博客网 时间:2024/06/17 08:23
Switch Game
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8918 Accepted Submission(s): 5327
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 on ).
Input
Each test case contains only a number n ( 0< n<= 10^5) in a line.
Output
Output the condition of the n-th lamp after infinity operations ( 0 - off, 1 - on ).
Sample Input
15
Sample Output
10Consider the second test case:The initial condition : 0 0 0 0 0 …After the first operation : 1 1 1 1 1 …After the second operation : 1 0 1 0 1 …After the third operation : 1 0 0 0 1 …After the fourth operation : 1 0 0 1 1 …After the fifth operation : 1 0 0 1 0 …The later operations cannot change the condition of the fifth lamp any more. So the answer is 0.Hinthint
Author
LL
Source
校庆杯Warm Up
Recommend
linle
#include<stdio.h>int main(){int num;while(scanf("%d",&num)!=EOF){int i,count=0; //记录转换了几次for(i=1;i<=num;i++){if(num%i==0) //转换的条件 count++;} if(count%2==0)printf("0\n");elseprintf("1\n");}return 0;}
- HDU_2053 Switch Game
- Switch Game
- Switch Game
- Switch Game
- Switch game
- HDOJ 2053 Switch Game
- 2053 Switch Game
- HDOJ2053 Switch Game
- Hdu 2053 - Switch Game
- Switch Game + 枚举
- HDU 2053 Switch Game
- hdu 2053 Switch Game
- Switch Game 2053
- 2053 Switch Game
- HDUJ 2053 Switch Game
- hdu 2053 Switch Game
- HDU 2053 Switch Game
- hdu-2053-Switch Game
- 最大缝隙
- zoj-1094-Matrix Chain Multiplication
- 【给客户提案6大秘籍】
- Hdu 3530 Subsequence 单调队列
- 由一个浮点数问题引发的致命问题
- HDU_2053 Switch Game
- JQuer版---列表框移动
- 计算机是如何启动的?
- uva 10130 - SuperSale(01背包简单变换)
- int, float, double之间不得不说的故事
- 背景图上加字
- POJ 1035 Spell checker (trie树)
- 0-范数
- Linux 的启动流程