UVA 568 - Just the Facts
来源:互联网 发布:江苏网络广播电视台 编辑:程序博客网 时间:2024/05/07 01:35
最直接的办法是用刘汝佳第一本书上的 大数阶乘 的方法,然后将3000改大一些~会发现最大的测试数据9999所用的时间是2秒多一点点,恰好不会超时~
这里想说的是大神的代码~给大神跪了。。表示自己也想到了要这么做,但是脑子不够用没能想出具体的做法。。再给大神跪了。。。
#include<stdio.h> int main() { int n,s,i; while(scanf("%d",&n)==1) { for(i=1,s=1;i<=n;i++) { s*=i; while(s%10==0) s/=10; s=s%100000; //这里要保留5位非零位~原因自己想吧 } printf("%5d -> %d\n",n,s%10); } return 0; }
再给大神跪了。。
0 0
- uva 568 - Just the Facts
- Uva 568 - Just the Facts
- uva 568 just the facts
- UVa 568 - Just the Facts
- uva 568 - Just the Facts
- uva-568 - Just the Facts
- Uva 568 - Just the Facts
- UVa 568 Just the Facts
- UVa 568: Just the facts
- UVA 568 Just the Facts
- uva 568 - Just the Facts
- uva 568 Just the Facts
- UVa 568 - Just the Facts
- uva 568 Just the Facts
- UVA 568 - Just the Facts
- uva 568 - Just the Facts
- uva 568 just the facts
- UVa 568 - Just the Facts
- test
- packet captuer tool: snoop
- HttpClient4.3使用总结
- 年末项目经验总结
- 哈希
- UVA 568 - Just the Facts
- 删除EditTextView光标所在位置的字符(监听系统的删除事件)
- MFC常用控件总览
- sql and csharp: Split Function
- sql and csharp: Split Function
- PCI Express接口
- SIP介绍
- dom对象与jquery对象的区别
- Android WiFi Architecture (WEXT/NL80211)