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 ...
随机推荐
- 用GOACCESS分析NGINX日志
参考URL: http://4b3r.com/goaccess-analyze-nginx-access-log/64/ http://jesuspan.sinaapp.com/crontab%E6% ...
- 抽象类的基本概念------abstract
抽象类的概念: 包含一个抽象方法的类就称为抽象类. 抽象方法:只声明但未实现的方法称为抽象方法,使用abstract关键字声明. 抽象类的定义及使用规则: abstract class A{ // 是 ...
- HASH JOIN算法
哈希连接(HASH JOIN) 前文提到,嵌套循环只适合输出少量结果集.如果要返回大量结果集(比如返回100W数据),根据嵌套循环算法,被驱动表会扫描100W次,显然这是不对的.看到这里你应该明白为 ...
- bootstrap 动态添加验证项和取消验证项
bootstrap 中的bootstrapValidator可以对前端的数据进行验证,但是有的时候我们需要动态的添加验证,这样需要我们动态的对bootstrapValidator的内容做修改. 传统的 ...
- UVA 195 Anagram
题意:求输入字符串的所有组合,按字典序输出! 解法:使用枚举(枚举前先找出最字符串的最小字典序)枚举时加上枚举生成条件! #include <iostream> #include < ...
- 基于mapreducer的图算法
作者现就职阿里巴巴集团1688技术部 引言 周末看到一篇不错的文章"Graph Twiddling in a MapReduce world" ,介绍MapReduce下一些图算法 ...
- Oracle Directory文件夹的知识
在上一章介绍expdp/impdp时曾使用过DIRECTORY这个概念,以下再简单说明下DIRECTORY的点点滴滴. MOS上对DIRECTORY的解释(266875.1): (1).基于服务端 v ...
- 学习设计模式--观察者模式(C++)
1. 说说简单的函数回调 首先说说一种简单的函数回调机制(一种通过获取对象的指针来进行函数的调用方法)以下是代码演示--- 这是观察者(被回调)部分: class Observer { public: ...
- 命令行运行android模拟器
创建模拟器 android create avd --name avd_4.1 --target "android-16" --abi armeabi-v7a Android 4. ...
- Handler Looper 原理 详解
演示代码 public class MainActivity extends ListActivity { private TextView tv_info; private CalT ...