Python--ZOJ1350
2015-03-26 21:31
417 查看
Python--ZOJ1350
这题比较简单,假设是对一个长为N的序列进行操作,每一次遍历按照一定的规则(当前序列号 除以 当前遍历的次数 余数为0)改变其状态,求其最后的为True(牢房打开)的有多少。不在累赘,代码如下:#-*- coding:utf-8 -*- #2015-03-26 state = False N = 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
相关文章推荐
- zoj 2829 python
- ZOJ 1350 监狱守长
- ZOJ 1350 The Drunk Jailer
- zoj 1048 求平均数 python
- ZOJ-1350
- zoj_1350 The Drunk Jailer 思路总结
- HDU 1337 || ZOJ 1350 The Drunk Jailer
- zoj 1037 python
- zoj 1048 求平均数 python
- ZOJ Problem Set - 1201 Inversion (Python)
- zoj 2772 python
- ZOJ Problem Set–1350 The Drunk Jailer
- zoj 3603 初次尝试用python 写代码
- ZOJ Problem Set - 1002 Fire Net (Python)
- zoj 1099 python代码
- zoj 1797 python
- zoj 1025 python
- python起步——zoj 1001、1037、1048、1049
- ZOJ Problem Set - 1350 The Drunk Jailer ac代码 memset
- [水][python]ZOJ1292