hdu2674 N! 找规律
2015-07-13 19:40
253 查看
取模时如果模较小时可以找规律,因为它的余数有限
#include <iostream> #include <string> #include <cstring> #include <queue> #include <stack> #include <cmath> #include <algorithm> #include <cstdio> using namespace std; int main() { int n; while(cin >> n) { long long res = 1; if(n > 41) { cout << "0" << endl; continue; } for(int i = 1 ; i <= n ;i ++ ) { res *= i; res %= 2009; } cout << res <<endl; } }
相关文章推荐
- fancy2D 源码解析 1 TestCpp
- vs2013的文件保存格式-fatal error C1071: 在注释中遇到意外的文件结束
- code
- macOS上Apache php配置
- OC 基础之----内存管理总结
- KVM介绍
- Python语法
- 全局钩子为什么要用DLL 共享节
- 谈谈前后端的分工协作
- 笔记——*p++, (*p)++, *++p, ++*p的区别
- smarty 循环输出栏目
- js 作用域,闭包及其相关知识的总结
- [LeetCode] Reverse Bits
- Jquery插件开发
- 通过配置worker_cpu_affinity参数提升nginx性能
- c# 中LinkLabel捕获F2进行重命名
- 程序员必知的8大排序(四)-------归并排序,基数排序(java实现)
- 但从谈论性能点SQL Server选择聚集索引键
- 单源最短路径(Dijkstra)
- HDU 1754 I Hate It