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 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
1
5
 
Sample Output
1
0
Hint
hint
Consider 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.
 
測试数据量不大,能够简单粗暴,这道题也就是水题。
#include <iostream>
#include <cstring>
using namespace std; int main()
{
int n;
int count;
while(cin>>n)
{
count=0;
for(int i=1;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count%2==0)cout<<"0"<<endl;
else cout<<"1"<<endl;
}
return 0;
}

杭电(hdu)2053 Switch Game 水题的更多相关文章

  1. hdu 2053 Switch Game 水题一枚,鉴定完毕

    Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  2. HDU—2021-发工资咯(水题,有点贪心的思想)

    作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵  但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每 ...

  3. hdu 1106:排序(水题,字符串处理 + 排序)

    排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

  4. 杭电 HDU ACM 2795 Billboard(线段树伪装版)

    Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. HDU 4950 Monster (水题)

    Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...

  6. HDU 4813 Hard Code 水题

    Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  7. HDU 4593 H - Robot 水题

    H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  8. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

  9. HDOJ(HDU) 1859 最小长方形(水题、、)

    Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ...

随机推荐

  1. windows上 python有多版本,如何管理,如何区别?

    win10环境下: 1. where python 查看安装了哪些版本. 2.更改对应python.exe 文件的名称就能更改调用python的名称了. 3.不同python是两个完全独立的软件(独立 ...

  2. 是我太天真之被BUG按在地上疯狂摩擦

    事情是这样的,我是一个追求完美的人,特别喜欢锦上添花,去年在学习python的时候做了一个作业:多重剪贴板,今天大概是吃饱了,查了一下自己的头发以后,我觉得可以挑战一下自己,所以决定为那个小程序添加一 ...

  3. 题解 CF1027D 【Mouse Hunt】

    这道题原本写了一个很复杂的DFS,然后陷入绝望的调试. 看了一下题解发现自己完全想复杂了. 这里大概就是补充一些题解没有详细解释的代码吧... (小声BB)现在最优解rank4(话说$O2$负优化什么 ...

  4. mysql中lock tables与unlock tables(锁表/解锁)使用总结

    php mysql lock tables 使用有感 mysql 的 表锁 lock tables 感觉就像一个 封闭的空间 mysql发现 lock tables 命令的时候,会将带有锁标记的表(t ...

  5. scala细节

    在高版本中,scala使用了自己的String,而不是java.lang.String 字符串转数字:"33.4".toDouble    "33.4".toF ...

  6. Java 实现状态(State)模式

    /** * @author stone */ public class WindowState { private String stateValue; public WindowState(Stri ...

  7. 关于checkbox的一些jquery操作

    表单在前端开发中是经常会遇到的,其中自然也少不了checkbox复选框,对于复选框的操作无外乎有以下三种:全选,全不选,反选.下面零度逍遥就给大家分析分析. 一.checkbox全选 大家都知道选择c ...

  8. POJ 1682 DP

    原创: http://www.cnblogs.com/proverbs/archive/2012/10/03/2711151.html 超高仿: http://blog.csdn.net/mars_c ...

  9. 多校-HDU 5351 MZL's Border 数学规律

    f[1] = 'b', f[2] = 'a', f[i] = f[i - 1] + f[i - 2] 斐波那契数列的字符串,给你n和m,前m位中,最长的前缀等于后缀的长度是多少.1≤n≤1000, 1 ...

  10. 轻量级记事本工具:CintaNotes

    本片文章介绍CintaNotes小工具 功能介绍: 方便.快捷的记录笔记: 快捷地从任何地方等截取内容生成笔记: 高效的记事本内容查询: 轻松的标签管理 支持移动设备和电脑同步(估计要收费) 官网下载 ...