HDU-4535-吉哥系列故事——礼尚往来
2013-03-31 11:21
211 查看
本来很简单的一个题,却因为取模的问题WA了几次~~~无语~
这个题就是个错排,因为存在递推式的,也没什么难度,见代码吧~
代码:
这个题就是个错排,因为存在递推式的,也没什么难度,见代码吧~
代码:
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const long long mod=1000000007; long long a[101]; int main() { int n; a[1]=0; a[2]=1; for(int i=3;i<=100;i++) { a[i]=((i-1)*(a[i-1]+a[i-2])); a[i]%=mod; } int cas; scanf("%d",&cas); while(cas--) { scanf("%d",&n); printf("%lld\n",a ); } return 0; }
相关文章推荐
- HDU 4535 吉哥系列故事——礼尚往来(水题,错排)
- hdu 4535 吉哥系列故事——礼尚往来
- hdu 4535 吉哥系列故事——礼尚往来
- hdu-4535-吉哥系列故事——礼尚往来-组合数学-错排-java
- HDU 4535 吉哥系列故事——礼尚往来(错排)
- hdu 4535 吉哥系列故事——礼尚往来
- Hdu 4535 吉哥系列故事——礼尚往来
- HDU 4535 吉哥系列故事——礼尚往来( 错排问题)
- 杭电4535吉哥系列故事——礼尚往来
- 吉哥系列故事——礼尚往来(4535)
- hdu 4535 吉哥系列故事——礼尚往来(错排)
- HDU_4535 吉哥系列故事——礼尚往来
- HDU 4535 吉哥系列故事——礼尚往来
- HDU:4535 吉哥系列故事——礼尚往来(数学:错排)
- HDU 4535 吉哥系列故事——礼尚往来
- hdoj-4535-吉哥系列故事——礼尚往来
- 杭电4535-吉哥系列故事——礼尚往来
- hdu 4535 吉哥系列故事——礼尚往来
- HDU 4535 吉哥系列故事——礼尚往来
- HDU 4512 吉哥系列故事——完美队形I(回文字符串的长度)