Enormous Input Test Solved Problem code: INTEST
import sys
import psyco #一键优化库
psyco.full() def main():
n, k = map(int, sys.stdin.readline().strip().split()) #两位数输入的复用
count = 0
for t in sys.stdin: #注意这个for循环方式
if int(t) % k == 0:
count += 1
print '%d' % count #注意格式输出 main() #写成函数的格式是一个良好的习惯
学到
python强大
有一键算法优化的库
复用
map这种
循环控制
格式输出
函数构成
错误
++和C里面的不一样
Enormous Input Test Solved Problem code: INTEST的更多相关文章
- Double Strings Solved Problem code: DOUBLE
# Fuking silly, OTZ.... import sys def main(): n = int(raw_input()) for num in sys.stdin: if int(num ...
- Factorial Solved Problem code: FCTRL
import sys #import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法 r = 0 whi ...
- ATM Solved Problem code: HS08TES
# ATM import sys withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结 ...
- Small factorials Solved Problem code: FCTRL2
import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了retur ...
- 【CodeChef】Enormous Input Test
The purpose of this problem is to verify whether the method you are using to read input data is suff ...
- Cooking Schedule Problem Code: SCHEDULE(优先队列)
Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his ...
- Holes in the text Add problem to Todo list Problem code: HOLES
import sys def count_holes(letter): hole_2 = ['A', 'D', 'O', 'P', 'Q', 'R'] if letter == 'B': return ...
- The Lead Game Add problem to Todo list Problem code: TLG
'''def count_lead(first, second): if first > second: return 1, first - second elif first == secon ...
- Turbo Sort Add problem to Todo list Problem code: TSORT
def heap_sort(ary): n = len(ary) first = int(n / 2 - 1) for start in range(first, -1, -1): # 3~0 rev ...
随机推荐
- BC 65 game
主持人一直某个数字在1到n范围,假设甲乙已经知道,甲先猜乙后,都采用最优策略,主持人说偏大还是偏小,不断缩小范围,问最后乙能会获胜的X的取值的个数. 如果n为奇数,那么仅当x=n/2乙必然获胜,若为奇 ...
- MySQL用户管理语句001
总的来说mysql的用户管理方法可以分为如下两种: 1.直接对mysql.user 表进行[insert | update | delete] + flush privileges 这种方式主要针对那 ...
- js Array数组的使用
js Array数组的使用 Array是javascript中的一个事先定义好的对象(也可以称作一个类),可以直接使用 创建Array对象 var array=new Array(): 创建指定元 ...
- \s+(?<request_time>\d+(?:\.\d+)?)\s+ 解释
<pre name="code" class="html"><pre name="code" class="ht ...
- html5视频小站
本文目的 练习HTML5 学习css3新特性 学习和熟悉移动html基础开发,如触摸知识 网站特点 界面设计仿360影视移动网站 支持主流现代浏览器(注:IE9,chrome,firefox.safa ...
- PhpEclipse插件
PHP开发工具 PHPEclipse PHPEclipse 是一个相当强大的一个Eclipse下开发PHP的插件,包括的功能有:PHP语法分析,调试,代码格式化,大纲视图,代码模板定制等. 安装地址: ...
- Seletion Sort
referrence: GeeksforGeeks The selection sort algorithm sorts an array by repeatedly finding the mini ...
- Windows Message Queue(优先队列)
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Mem ...
- 多线程中的lua同步问题
最近写paintsnow::start时出现了一个非常麻烦的BUG,程序的Release版本大约每运行十几次就会有一次启动时崩溃(Debug版本还没崩溃过),崩溃点也不固定.经过简单分析之后,确定是线 ...
- 理解会话中的Cookie和Session对象
会话可以简单理解为:用户打开一个浏览器,点击多个超链接,访问服务器多个web资源,然后关闭浏览器,整个过程称之为一个会话. 在java语言中,Servlet程序是由WEB服务器调用,web服务器收到客 ...