#1085385

Solution for 0537: Bingo by dohatsu

Source Code Status Test Cases
    Policy: public     Reviewed: 293    
00.00 sec    2328 KB    34 lines     539 bytes    2014-09-29 17:48
#include<iostream>
using namespace std;
typedef long long ll;
ll mod=100000;
int N,M,S;

ll dp[50][3001];

void init(){
  for(int i=0;i<50;i++)
    for(int j=0;j<3001;j++)
      dp[i][j]=0;
  dp[0][0]=1;
}

int main(){
  while(1){
    cin>>N>>M>>S;
    if(N==0&&M==0&&S==0)break;
    init();
    for(int i=1;i<=N*N;i++){
      for(int j=0;j<=S;j++){
	if(j-i>=0)dp[i][j]+=dp[i-1][j-i];
	if(j-i>=0)dp[i][j]+=dp[i][j-i];
	if(j-M-1>=0)dp[i][j]+=(mod-dp[i-1][j-M-1]);
	dp[i][j]%=mod;
      }
    }
    cout<<dp[N*N][S]<<endl;
  }
  return 0;
}


Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 1/1 C++ CPU: 00.00 sec Memory: 2328 KB Length: 539 B 2014-09-29 17:48 2014-09-29 17:48
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.00 sec 2328 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags