您的位置:首页 > 其它

2014年山东省第五届ACM大学生程序设计竞赛 E. Factorial

2014-06-02 22:48 351 查看


Factorial




Time Limit: 2000ms Memory limit: 65536K 有疑问?点这里^_^



题目描述

Homelesser hates mathematics. He cannot even do addition and subtraction, not to mention computing factorial. He asks Cainiao2hao for help. Cainiao2hao is always busy solving more difficult problems. And now, please help
Homelesser to compute factorial. If you cannot do it well, Cainiao2hao will think you are as fool as Homelesser.


输入

The first line contains only one integer T (T is about 10) indicates the number of test cases. For each case there are one integer n (0 ≤ n ≤ 10).


输出

One line for each case specifying the factorial of n.


示例输入

2
4
3



示例输出

24
6



提示


来源

2014年山东省第五届ACM大学生程序设计竞赛


示例程序

提交

状态

讨论

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t,n,i,sum;
cin>>t;
while(t--)
{
sum=1;
cin>>n;
for(i=1;i<=n;i++)
{
sum*=i;
}
cout<<sum<<endl;
}
return 0;
}

/**************************************
Problem id	: SDUT OJ 2881
User name	: mxjr130326刘继国
Result		: Accepted
Take Memory	: 460K
Take Time	: 0MS
Submit Time	: 2014-06-01 15:06:29
**************************************/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐