UVA-568 Just the Facts
来源:互联网 发布:kali linux arp 编辑:程序博客网 时间:2024/06/07 00:52
2016-08-11
UVA - 568 Just the Facts
题目大意:求阶乘的最后一位非零数字。
解题思路:此题可以直接用大数的阶层来得出。
注意:大数阶层得出的顺序是个十百千万。具体算法见博客,“大数阶层”。
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int num[3000];int main() {int n;while ( ~scanf("%d", &n) ) {memset (num, 0, sizeof(num));num[0] = 1;for (int i = 2; i <= n; i++) {int c = 0;for (int j = 0; j < 3000; j++) {int s = num[j] * i + c;num[j] = s % 10;c = s / 10;}}for (int i = 0; i < 3000; i++)if ( num[i] ) {printf("%5d -> %d\n", n, num[i]);break;}}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
- 蓝鸥Unity开发基础——关系运算和逻辑运算学习笔记
- C程序编译过程浅析
- 查找嵌入式软件技术的缺陷
- log4js的配置难点解析
- PHP PDO笔记
- UVA-568 Just the Facts
- 反编译APK获取代码&资源
- c,c++里面,头文件里面的ifndef /define/endif的作用
- CNZZ数据专家使用方法?
- Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version
- hdu4920Matrix multiplication(模3矩阵相乘)
- Lock和Synchronized区别
- 每天一个linux命令(1):ls命令
- 在OpenCV for Android 2.4.5中使用SURF(nonfree module)