poj 1604
来源:互联网 发布:linux 查看监听端口 编辑:程序博客网 时间:2024/06/05 01:10
java做的,特么慢.
import java.util.*;import java.io.BufferedInputStream;import java.math.*;public class Main {public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in));int n; while(cin.hasNext()){ BigDecimal fact = BigDecimal.valueOf(1); n = cin.nextInt(); int i; for(i = 1; i <= n; ++i) fact = fact.multiply(new BigDecimal(i)); String s = fact.toString(); for(i = s.length() - 1; i >= 0; --i) if(s.charAt(i) != '0') break; System.out.printf("%5d",n); System.out.print(" -> "); System.out.println(s.charAt(i));} }}
- poj 1604
- POJ 1604
- poj-1604
- poj 1604
- POJ 1604
- poj 1604
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- 线程的创建和等待
- linux lsof
- hdu 1575 Tr A (矩阵快模幂)
- 介绍VC中3种方法得到文本框中的值
- HTTP协议详解个人总结(1)
- poj 1604
- Unix网络编程--进程间通信--管道通信
- Spring_c3p0 配置详解
- 循环条件中使用逗号
- org.apache.maven.plugin.MojoExecutionException: protoc failure
- WireShark过滤语法
- 常用软件自动安装,软件批量安装包升级版
- Strict standards: Non-static method cls_image::gd_version() should not be called statically in
- 多边形区域填充算法