Factorial Solved Problem code: FCTRL
import sys
#import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法
r = 0
while 5 <= n:
n /= 5
r += n
return r def main():
n = int(sys.stdin.readline())
for t in sys.stdin: #这种循环输入一点问题也没
print z(int(t)) #输入的是String, 一定要记得int转化 main() #这种函数架构很科学和良好
///另一种方法
for n in map( int , sys.stdin.read().split() )[1:]: print z( n )
学习
for t in sys.stdin 这种循环输入可以复用
这种函数式的架构很科学
数组初步了解,冒号的使用精髓
[1:] 躲过了第一个元素(是数量),然后到最后一位元素
错误
psyco()不总是能用
Factorial Solved Problem code: FCTRL的更多相关文章
- Small factorials Solved Problem code: FCTRL2
import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了retur ...
- ATM Solved Problem code: HS08TES
# ATM import sys withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结 ...
- 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 ...
- Enormous Input Test Solved Problem code: INTEST
import sys import psyco #一键优化库 psyco.full() def main(): n, k = map(int, sys.stdin.readline().strip() ...
- 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 ...
- Use Spring Insight Developer to Analyze Code, Install it with Tomcat, and Extend it with Plugins--转载
原文地址:http://www.tomcatexpert.com/blog/2012/12/05/use-spring-insight-developer-analyze-code-install-i ...
随机推荐
- microsoft
http://blog.csdn.net/morewindows/article/details/8684061 http://blog.csdn.net/watkinsong/article/det ...
- uva 10036 Problem C: Divisibility
题意:能否在一个整数序列的每相邻的两项之间添加一个加减号,使得最终结果能被一个给定整数K<=100整除. dp[i][j]表示第i个数取余k为j的布尔值. #include <cstdio ...
- Android中支持的常用距离单位
px(像素):每个px对应屏幕上的一个点.dip或dp(device independent pixels,设备独立像素):一种基于屏幕密度的抽象单位.在每英寸160点的显示器上,1dip=1px.但 ...
- Linux系统编程(25)——终端
在Linux系统中,用户通过终端登录系统后得到一个Shell进程,这个终端成为Shell进程的控制终端.控制终端是保存在PCB中的信息,而我们知道fork会复制PCB中的信息,因此由Shell进程启动 ...
- matrix矩阵求逆 与解方程模板 留做备用 (有bug,待补充)
// // main.cpp // 矩阵求逆 // // Created by 唐 锐 on 13-6-20. // Copyright (c) 2013年 唐 锐. All rights reser ...
- 知方可补不足~用xsl来修饰xml
概念相关 XSL是可扩展样式表语言的外语缩写,是一种用于以可读格式呈现 XML(标准通用标记语言的子集)数据的语言. 起始于 XSL 万维网联盟(W3C)开始发展 XSL 的原因是:存在着对于基于 X ...
- JAVA 将接口的引用指向实现类的对象
有一个很简单的例子,java.util中的类ArrayList实现了接口List则生成ArrayList对象时可用以下语句. List list=new ArrayList(); 也就是说所有实现了接 ...
- [nagios监控] NRPE: Unable to read output 的原因及排除
nrpe被监控端运行定义命令正常,监控端运行 #/usr/local/nagios/libexec/check_nrpe -H 117.121.9.200 -c check_oracle_tables ...
- [Angular 2] *ngFor with index
Let's see how to track index when we use 'ngFor: <li *ngFor="#hero of heros | async, #i = in ...
- Hadoop 开源调度系统zeus(二)
紧跟之前Hadoop 开源调度系统zeus(一) 本节主要介绍一下zeus的架构: 先给一个zeus的架构图 无论Master还是Worker都有一套WEB UI,无论从哪个上面去看,看到的结果都是一 ...