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

来源:互联网 发布:jquery.fly.js用法 编辑:程序博客网 时间:2024/06/05 05:05

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.
 

示例输入

243

示例输出

246

提示

 

来源

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  **************************************/


0 0