sdnu1205.Factorial !
来源:互联网 发布:如何删除mac系统 编辑:程序博客网 时间:2024/06/03 23:00
1205.Factorial !
Time Limit: 1000 MS Memory Limit: 32768 KB
Total Submission(s): 233 Accepted Submission(s): 48
Description
Your task is to Calculate ” X !“(0<=X<=15)
Input
The input will consist of a series of pairs of integers X.
Output
For each input integers you should output X! one line,and followed by a blank line.
Sample Input
1
2
Sample Output
1
2
Hint
Source
Sunshine
#include<cstdio>#include<algorithm>#include<iostream>#include<cmath>#include<iomanip>#include<cstring>using namespace std;int main(){ int x,i; long long s; while(scanf("%d", &x)!=EOF) { s=1; for(i=1; i<=x; i++){ s*=i; } printf("%lld\n\n", s); } return 0;}
注意阶乘!!!!用int会超的!!!! int 32767
因为这个wa了3次。。。绝望。。。
阅读全文
0 0
- sdnu1205.Factorial !
- Factorial!
- Factorial
- Factorial
- factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- Factorial
- factorial
- 硬盘寻址模式、分区表
- java操作mongodb(高级查询)
- Android 多线程断点续传-开源项目xutils3实现
- github push 提交代码时停止在writing objects怎么办
- 网络编程, /*日常笔记*/
- sdnu1205.Factorial !
- 算法总结
- C/C++,windows 和 linux 获取目录下文件列表的方法
- 显示和隐式的Intent 跳转界面
- UML用例图之寻找参与者与用例
- 机器学习中的范数
- iOS 7+,使用原生API生成QRCode。
- Android Studio json 数据
- SpringMVC+Hibernate+jQuery+js+css+jsp+nginx整合时,(1)jsp引入js,css无效;(2)插入数据库时某字段为空;(3)web.xml配置完后,从数据库读数