hdu 1337 The Drunk Jailer
http://acm.hdu.edu.cn/showproblem.php?pid=1337
#include <cstdio>
#include <cstring>
#define maxn 200
using namespace std;
int main()
{
int t;
int a[maxn];
scanf("%d",&t);
int n;
while(t--)
{
scanf("%d",&n);
for(int i=; i<=maxn; i++) a[i]=;
for(int i=; i<=n; i++)
{
for(int j=i; j<=n; j+=i)
{
a[j]^=;
}
}
int ans=;
for(int i=; i<=n; i++)
{
if(!a[i]) ans++;
}
printf("%d\n",ans);
}
return ;
}
hdu 1337 The Drunk Jailer的更多相关文章
- THE DRUNK JAILER 分类: POJ 2015-06-10 14:50 13人阅读 评论(0) 收藏
THE DRUNK JAILER Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24918 Accepted: 1563 ...
- poj 1218 THE DRUNK JAILER【水题】
THE DRUNK JAILER Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 25124 Accepted: 1576 ...
- poj 1218 THE DRUNK JAILER
THE DRUNK JAILER Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 23358 Accepted: 1472 ...
- [ACM] POJ 1218 THE DRUNK JAILER (关灯问题)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/sr19930829/article/details/37727417 THE DRUNK JAILE ...
- HDU 1337 && POJ 1218&& zju 1350 方法总结
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1337 杭电 http://poj.org/problem?id=1218清华 http://acm.zj ...
- 2076. The Drunk Jailer
Problem A certain prison contains a long hall of n cells, each right next to each other. Each cell h ...
- POJ 1218 THE DRUNK JAILER(类开灯问题,完全平方数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188 题目大意:n为5-100之间的一个数,代表有多少间牢房,刚开始所有房间打开,第一轮2的倍数的房间 ...
- Poj1218_THE DRUNK JAILER(水题)
一.Description A certain prison contains a long hall of n cells, each right next to each other. Each ...
- ZOJ Problem Set - 1350 The Drunk Jailer ac代码 memset
这是一道很简单的题目,题目大概意思说下:就是有n个监狱(编号从1到n),第一次全部打开,第二次打开编号为2的倍数的,第三次打开编号为3的倍数的,以此类推...最后问你有几个监狱是打开的 题目中我使用了 ...
随机推荐
- spring的数据源基本配置
aplictaionContext-dataSource的配置: <?xml version="1.0" encoding="utf-8"?> &l ...
- Java 学习 第六篇;接口
1: 接口定义修饰符 interface 接口名{ 常量定义: 抽象方法定义:}修饰符 interface 接口名 extends 父接口表{ 常量定义: 抽象方法定义:}-> 修饰符可以是pu ...
- 导入Excel表格到SharePoint站点
在Excel中创建表 选中所有要导入的行,点击菜单"插入"->"表格" 如果数据内容包含表头,选择"我的表格包含表头". 选择菜单 ...
- linux find详解
find是最常见和最强大的查找命令,你可以用它找到任何你想找的文件. find的使用格式如下: $ find <指定目录> <指定条件> <指定动作> - < ...
- winform程序中Label自动换行
参考的是网上这篇文章:http://www.cnblogs.com/qb371/archive/2011/09/20/2366310.html 不过貌似注释有点问题,我的代码如下,我是将label放在 ...
- 给Select赋值 innerHTML 不兼容IE6\IE7\IE8\IE9
<select class="b-select" id="location-province" name="Province" def ...
- 怎样合并排序数组(How to merge 2 sorted arrays?)
Question: We have 2 sorted arrays and we want to combine them into a single sorted array. Input: arr ...
- 独立写作(A or B)
开头:On contemporary society(一般的背景)/ With the advent of the technologically advanced society (the info ...
- Linux系统启动流程(2)
内核设计风格: RedHat, SUSE核心:动态加载 内核模块内核:/lib/modules/“内核版本号命令的目录”/vmlinuz-2.6.32/lib/modules/2.6.32/ RedH ...
- Javascript 解构的用处
对象的解构赋值,可以很方便地将现有对象的方法,赋值到某个变量. let { log, sin, cos } = Math; 上面代码将Math对象的对数.正弦.余弦三个方法,赋值到对应的变量上,使用起 ...