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 ...
随机推荐
- npm install Error:EPROTO: protocol error, symlink '../mime/cli.js' -> '/vagrant/src/nodejs/node_modules/express/node_modules/send/node_modules/.bin/mime'
我在ubuntu上使用npm安装依赖是出现下面错误: npm ERR! Linux 3.13.0-101-genericnpm ERR! argv "/usr/bin/nodejs" ...
- 关于tuple的只读特性
a = (1,3,[5,4,1]) a[2][1] = 2 print(a) 结果是:(1,3,[5,2,1]) 可以看到,在这里tuple的内容被修改了. 原因就是tuple的“只读”属性是指tup ...
- pyspider安装后,点击run,报pyhton has stop working或python已停止运行的错误
问题解决虽然只有几句话,但是背后花了一天时间,各种FQ搜索. pyspider目测只支持32位的系统,所以你下载32位的python安装就行了,然后安装pyspider运行就没有问题了,坑爹啊---- ...
- aliyun 安装图形
yum安装图形界面: 1) yum groupinstall "X Window System" yum install xclock yum groupinstall -y &q ...
- jQuery多版本的使用,同一文件多个版本引用
<html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...
- 导入时如何定制spring-boot依赖项的版本
spring-boot通过maven的依赖管理为我们写好了很多依赖项及其版本,我们可拿来使用.spring-boot文档介绍了两种使用方法,一是继承,二是导入. 通过<parent>继承: ...
- C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\11.0
Generating Files with the TextTransform Utility \Program Files\Common Files\Microsoft Shared\TextTem ...
- JDBC官方用法
JDBC官方用法https://bitbucket.org/xerial/sqlite-jdbc/#markdown-header-usage 代码下载https://github.com/xeria ...
- ObjectOutputStream 追加写入读取错误
摘自http://blog.csdn.net/mitkey/article/details/50274543 问题描述: 用类ObjectOutputStream向文件写读对象时,碰到一个问题:新建一 ...
- 【转】C/C++程序员应聘常见面试题深入剖析
1.引言 本文的写作目的并不在于提供C/C++程序员求职面试指导,而旨在从技术上分析面试题的内涵.文中的大多数面试题来自各大论坛,部分试题解答也参考了网友的意见. 许多面试题看似简单,却需要深厚的基 ...