Python--ZOJ1350
来源:互联网 发布:淘宝怎么申请换货 编辑:程序博客网 时间:2024/06/14 10:24
Python--ZOJ1350
这题比较简单,假设是对一个长为N的序列进行操作,每一次遍历按照一定的规则(当前序列号 除以 当前遍历的次数 余数为0)改变其状态,求其最后的为True(牢房打开)的有多少。不在累赘,代码如下:
#-*- coding:utf-8 -*-#2015-03-26state = FalseN = input()while N: n = input() cell = [False for i in range(n+1)] for i in range(1,n+1): for j in range(1,n+1): if j%i==0: if cell[j] == False: cell[j] = True else: cell[j] = False count = 0 for i in cell[1:]: if i: count += 1 print count N -= 1
0 0
- Python--ZOJ1350
- zoj1350
- zoj1350
- [水]ZOJ1350
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- 通过socket读取异地文件
- Python编程基础之十五网络编程
- View中的scrollTo和scrollBy
- Android下开机启动后U盘经常不能自动挂载
- 照片上传回显基于spring mvc的 MultipartHttpServletRequest
- Python--ZOJ1350
- 在VC中使用自定义资源制作自解压安装程序
- 大神 PK 红米背后,2G 内存将成互联网手机分水岭
- 腾讯研发工程师A笔试卷
- c语言编程:实现数字的翻转
- POJ 3080 Blue Jeans(暴力)
- 我的自建博客成立啦!wxtlife.com
- 最佳实践:针对性能问题的主动型数据收集 (文档 ID 1549179.1)
- Linux登录验证机制、SSH Bruteforce Login学习