您的位置:首页 > 其它

hdu 4535 吉哥系列故事——礼尚往来(错排)

2017-09-08 17:26 246 查看
http://acm.hdu.edu.cn/showproblem.php?pid=4535

裸的错排问题。

#include<iostream>
using namespace std;
#define mod 1000000007
long long d[1005];
int main()
{
int t,n;
d[1]=0,d[2]=1;
for(int i=3;i<=100;i++)
d[i]=(i-1)*(d[i-1]+d[i-2])%mod;
cin>>t;
while(t--)
{
cin>>n;
cout<<d
<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: