joj 1386解题报告
来源:互联网 发布:收购淘宝账号400元 编辑:程序博客网 时间:2024/06/05 10:07
1386: 500!
In these days you can more and more often happen to see programs which perform some useful calculations being executed rather then trivial screen savers. Some of them check the system message queue and in case of finding it empty (for examples somebody is editing a file and stays idle for some time) execute its own algorithm.
As an examples we can give programs which calculate primary numbers.
One can also imagine a program which calculates a factorial of given numbers. In this case it is the time complexity of order O(n) which makes troubles, but the memory requirements. Considering the fact that 500! gives 1135-digit number no standard, neither integer nor floating, data type is applicable here.
Your task is to write a programs which calculates a factorial of a given number.
Assumptions: Value of a number "n" which factorial should be calculated of does not exceed 500.
Input
Any number of lines, each containing value "n" for which you should provide value of n!Output
2 lines for each input case. First should contain value "n" followed by character `!'. The second should contain calculated value n!. Mind that visually big numbers will be automatically broken after 80 characters.Sample Input
103050100
Sample Output
10!362880030!26525285981219105863630848000000050!30414093201713378043612608166064768844377641568960512000000000000100!93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
}
- joj 1386解题报告
- joj 1386解题报告
- joj 1920解题报告
- joj 1019解题报告
- joj 1026解题报告
- JOJ 1054: Area 解题报告
- JOJ 1058 T9 解题报告
- JOJ 1068: Cipher 解题报告
- JOJ 1069: Joseph 解题报告
- JOJ 1051: Flip and Shift 解题报告
- JOJ 1052: Square Destroyer解题报告
- JOJ 1061: Rank The Teams 解题报告
- JOJ 1055: Cog-Wheels 解题报告
- JOJ 1060: Time And Motion 解题报告
- JOJ 1063: A Funny Game 解题报告
- JOJ 1064: Caeser Comes Back 解题报告
- JOJ 1065: Truck Driver 解题报告
- JOJ 1071: Maya Calendar 解题报告
- 第八讲 GUI/图形用户界面
- 财富500强排名(2010)
- 注册表控制软件使用次数
- Opencart支付宝插件 -支持多种接口
- Drupal安装成功后只能访问主页的问题
- joj 1386解题报告
- CRC(循环冗余校验码)中的模2除运算
- IE css hack汇总
- joj 1920解题报告
- 第九讲 网络编程
- BCB配置和使用GDI+
- FlexPaper使用小记
- XManager 系统配置
- 嵌入式SQL笔记