标签:des style http color os io strong for
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 406 | Accepted: 179 |
Description
Input
Output
Sample Input
1 0 2 0 3 2 0 0
Sample Output
1 0 4
Source
#include<cstdio> #include<cstring> #include<iostream> #define mod 9937 using namespace std; int dp[80+10][10000+10]; void init() { memset(dp,0,sizeof(dp)); dp[1][0]=1; dp[2][1]=2; for(int i=3;i<=81;i++) for(int j=1;j<=10001;j++) { if(j>=2) dp[i][j]=(dp[i-1][j-2]*(i-2))%mod; if(j>=1) dp[i][j]=(dp[i][j]+dp[i-1][j-1]*2)%mod; } } int main() { int n,m; init(); while(~scanf("%d%d",&n,&m)) { if(n==0&&m==0) return 0; cout<<dp[n][m]<<endl; } return 0; }
poj3934Queue(dp),布布扣,bubuko.com
标签:des style http color os io strong for
原文地址:http://blog.csdn.net/u014303647/article/details/38453979