http://acm.hdu.edu.cn/showproblem.php?pid=2674
小技巧 :当数很大时mod2009就为0了。。。。。。。。
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include
"
iostream
"
using namespace std;
int main()
{
int n;
int i;
while (cin >> n)
{
int mul = 1 ;
if (n <= 1000 )
{
for (i = 1 ;i <= n;i ++ )
{
mul *= i % 2009 ;
mul %= 2009 ;
}
}
else mul = 0 ;
cout << mul << endl;
}
return 0 ;
}
using namespace std;
int main()
{
int n;
int i;
while (cin >> n)
{
int mul = 1 ;
if (n <= 1000 )
{
for (i = 1 ;i <= n;i ++ )
{
mul *= i % 2009 ;
mul %= 2009 ;
}
}
else mul = 0 ;
cout << mul << endl;
}
return 0 ;
}