题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=2674
题目大意:
求n!%2009的值
思路:
由于模2009,所以大于等于2009的直接为0,前2009位打表
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
const int maxn = 1e4 + ;
typedef long long ll;
ll T, n, m;
ll a[maxn];
int main()
{
a[] = ;
for(int i = ; i <= ; i++)
{
a[i] = a[i - ] * i % ;
}
while(cin >> n)
{
if(n >= )cout<<""<<endl;
else cout<<a[n]<<endl;
}
return ;
}