第五届山东省ACM Factorial

Factorial

水题,求阶乘

#include<cstdio>  
#include<cstring>  
#include<cmath>  
#include<cstdlib>  
#include<iostream>  
#include<algorithm>  
#include<vector>  
#include<map>  
#include<queue>  
#include<stack>  
#include<string>  
#include<map>  
#include<set>  
#include<ctime>  
#define eps 1e-6  
#define MAX 100005  
#define INF 0x3f3f3f3f  
#define LL long long  
#define pii pair<string,int>  
#define rd(x) scanf("%d",&x)  
#define rd2(x,y) scanf("%d%d",&x,&y)  
const int dir[][2] = { {-1, 0}, {0, -1}, { 1, 0 }, { 0, 1 } };  
using namespace std;  
int main(){  
  int n,x;  
  rd(n);  
  while(n--){  
    rd(x);  
    int sum=1;  
    for(int i=1;i<=x;i++)  
        sum*=i;  
    printf("%d\n",sum);  
  }  
  return 0;  
}  


你可能感兴趣的:(第五届山东省ACM Factorial)