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 <cstdio>
int main()
{
int n, ans;
while(~scanf("%d",&n))
{
ans=;
for(int i=;i<=n;i++)
{
if(n%i==)
{
ans=-*ans;
}
}
printf(ans==?"0\n":"1\n");
}
return ;
}

HDU_2053的更多相关文章

随机推荐

  1. 杭电 2047 阿牛的EOF牛肉串 (递推)

    阿牛的EOF牛肉串 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  2. unity3d android导出项目编译Multiple dex files define Lcom/unity3d/player/UnityPlayerActivity

    unity3d版本: 4.1.2 在导出android工程进行编译时,发现出现Multiple dex files define Lcom/unity3d/player/UnityPlayerActi ...

  3. MediaPlayer+SurfaceView 视频播放 示例

    SurfaceView的原理         SurfaceView在视频播放中起到显示画面的作用,而视频的播放主要通过MediaPlayer来控制.         SurfaceView 允许我们 ...

  4. java03变量和基本数据类型

    /** * * 失去一日甚易,欲得回已无途! * * 关键字:java中的关键字 就是指 已经被定义了的单词! * 我们就不能再拿关键字 作为我们的变量名! * 常用的关键字: * 基本数据类型: * ...

  5. 匹配不含有某个信息的sql语句写法

    SELECT id,order_id,flight_info FROM order_flights WHERE mark=0 AND flight_info REGEXP '[^() DAY)]' O ...

  6. TextView drawablePadding没有效果

    1.当TextView 设置宽度设置为match_parent的时候 TextView drawablePadding没有效果 ,字设置了center位置,但是和左边的图片离开很远 2.当TextVi ...

  7. rpm命令数据库修复日志

    今天在linux安装软件过程中遇到了一个小坑,rpm数据库被破坏: 状况: #rpm -qa | grep rpm 返回: [解决方案] 删除旧数据库,然后重建数据库: 删除旧数据库: # rm /v ...

  8. [php基础]PHP.INI配置:文件上传功能配置教程

    昨天分享了在PHP网站开发中如何在php.ini中配置实现session功能的PHP教程,今天继续分享在利用PHP实现文件上传功能时几点关键php.ini的配置. 说到在php.ini中的文件上传的配 ...

  9. 解决Cacti监控图像断断续续问题

    最近cacti的图像全都是断断续续.新加的设备,图像也是这样,查看cacti 的log发现大量下面类似的错误信息:04/12/2011 03:54:37 PM - SPINE: Poller[0] H ...

  10. JAVA多态需要注意的一些问题

    public class MainTest { static class A { public int i; public void f() { System.out.println("AA ...