Skip to content

Instantly share code, notes, and snippets.

@Luzhiled
Created December 4, 2016 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luzhiled/8568f6850e90237ea1a4e2d133c4cf24 to your computer and use it in GitHub Desktop.
Save Luzhiled/8568f6850e90237ea1a4e2d133c4cf24 to your computer and use it in GitHub Desktop.
ビンゴ
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e5;
int n, m, s;
int dp[50][3001];
int main()
{
while (cin >> n >> m >> s, n){
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
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] + 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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment