uva 10220

可采用uva 623这道题求N!,再最后稍微改一下就好。

参考代码:

 }
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int maxn = ;
int f[maxn]; int main()
{
int n;
while (cin >> n)
{
memset(f, , sizeof(f));
int len = ;
f[] = ;
for (int i = ; i <= n; i++)
{
int c = ;
for (int j = ; j < len; j++)
{
int t = f[j] * i + c;
f[j] = t % ;
c = t / ;
}
if (c) f[len++] = c;
}
int ans = ;
for (int i = len - ; i >= ; i--) {
while (f[i])
{
int t = f[i] % ;
ans += t;
f[i] /= ;
}
}
cout << ans << endl;
}
return ;
}

最新文章

  1. virtualbox之usb设备的分配
  2. grid style
  3. HTML-正则表达式
  4. MyEclipse从数据库反向生成实体类之Hibernate方式 反向工程
  5. Tea---hdu5881(规律)
  6. read,for,case,while,if简单例子
  7. operator重载的使用
  8. 2015年阿里巴巴蚂蚁金服校招JAVA研发工程师内推电话面试
  9. 【巧妙预处理系列+离散化处理】【uva1382】Distant Galaxy
  10. 【原创】leetCodeOj ---Remove Duplicates from Sorted List II 解题报告
  11. ural1855 Trade Guilds of Erathia
  12. static 及 extern
  13. 用IO流中的File类来创建文件及目录
  14. 0_Simple__fp16ScalarProduct
  15. 将 MVVM 演化为 MVVMM
  16. ES6躬行记(2)——扩展运算符和剩余参数
  17. 使用proxy来简单的实现一个观察者
  18. Leetcode 326.3的幂 By Python
  19. 归并排序merge_sort
  20. php file_get_contents fopen 连接远程文件

热门文章

  1. 修改input标签输入样式
  2. &lt;br&gt;和换行符/n
  3. CodeChef--Cards, bags and coins
  4. win7开机启动项设置
  5. 解决底部Button遮挡ListView最后一项内容的bug
  6. 学习Boost/Asio
  7. Linux下允许MySQL 授权远程连接
  8. Linux环境变量的种类
  9. 模拟19 题解(waiting)
  10. 通过sql 向数据库插入多行语句