Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> using namespace std; #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) int dp[50][3001]; int n, m, s; const int mod = 100000; int main() { while (cin >> n >> m >> s, n || m || s) { n *= n; fill(dp[0], dp[n + 1], 0); dp[0][0] = 1; FO...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define UNDEF -1 int N,M,S,dp[2001][3001]; int ths(int begin,int end,int count) { return ((begin + end) * count) / 2; } int main(void) { while(true) { cin >> N >> M >> S; if(N == 0 && M == 0 && S == 0) exit(0); for(int i = ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<algorithm> using namespace std; int MOD=100000; int dp[2001][3001]; int sum[2001][3001]; int main(){ int a,b,c; while(scanf("%d%d%d",&a,&b,&c),a+b+c){ for(int i=0;i<2001;i++) for(int j=0;j<3001;j++) dp[i][j]=dp[i][j]=sum[i][j]=0; dp[0][0]=1; for(int i=0;i<=b;i++){ sum[i][0]=...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = (n) - 1; i >= 0; i--) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define pf push_front #d...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> using namespace std; #define MAX_N 7 #define MAX_S 3000 #define MOD 100000 int dp[MAX_N * MAX_N + 1][MAX_S + 1]; int main() { int N, M, S; while (scanf("%d %d %d", &N, &M, &S), N || M || S) { memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int k = 1; k <= M; ++k) { fo...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<map> #include<cstdio> #include<cstring> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define REP(n) rep(i,n) #define all(n) n.begin(),n.end() const int MAXN = 7, MAXS = 3000 ; int n, m, s; unsigned int dp[MAXN * MAXN + 2][...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 1e5; int main() { ios::sync_with_stdio(false), cin.tie(0); int N, M, S; while (cin >> N >> M >> S, N | M | S) { N *= N; vector<vector<int>> dp(S + 1, vector<int>(N + 1)); dp[0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = S; j >= i; j-...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> using namespace std ; const int M = 100000; int main(){ int n, m, s, dp[50][3001]; while(cin >> n >> m >> s && (n|m|s)){ fill(dp[0], dp[50], 0); dp[0][0] = 1; for(int k=1;k<=m;k++){ for(int i=n*n;i>0;i--){ for(int j=k;j<=s;j++){ dp[i][j...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
//y09-6 ビンゴ(2回目) #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <time.h> #include <string> #include <vector> #include <map> #include <list> #include <set> #include <stack> #include <queue> #include <cstdlib> #include <algorithm> #include <random> #include <cassert> using namespace...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<sstream> #include<vector> #include<set> #include<map> #include<queue> #include<algorithm> #include<numeric> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<cassert> #define rep(i,n) for(int i=0;i<n;i++) #define all(c) (c).begin(),(c).end() #define mp make_pair ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#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++){...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) int main(){ int n,m,s; while(cin>>n>>m>>s){ if(n==0&&m==0&&s==0)break; static int dp[2][2300][3300]; rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0; ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int dp[2][2000][3000]; signed main() { int a, b, c; while (cin >> a >> b >> c, a || b || c) { a *= a; c -= a*(a + 1) / 2; b -= a; memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int d = 1; d <= a; d++) { memset(dp[d & 1], 0, sizeof(dp[d & 1])); for (int...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) int dp[2][2300][3300]; int main(){ int n,m,s; while(cin>>n>>m>>s){ if(n==0&&m==0&&s==0)break; rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0; dp[0][0]...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstring> using namespace std; int n,m,s; int dp[50][3001]; int main(){ while(cin >> n >> m >> s && n){ n *= n; m = min(m,s); memset(dp,0,sizeof(dp)); dp[0][0] = 1; for(int j = 1 ; j <= m ; j++){ for(int k = s-j ; k >= 0 ; k--){ for(int i = 1 ; i <= n ; i++){ (dp[i][...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int dp[2][2001][3001]; const int mod = 100000; int main(){ int n,m,s; while(cin>>n>>m>>s){ if(n==0)break; n *= n; for(int j=0;j<=m;j++) for(int k=0;k<=s;k++) dp[0][j][k]=0; dp[0][0][0]=1; for(int i=0;i<=n;i++){ int now=i&1; int n...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <cmath> #include <algorithm> #include <functional> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define rep1(i,n) for(int i=1;i<=(n);++i) #define all(c) (c).begin(),(c).end() #define pb push_back #define fs first #define s...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; #define MOD 100000 int N, M, S; int dp[2][2001][2001]; int T[2001][2001]; int main() { while (cin >> N >> M >> S) { if (N == 0 && M == 0 && S == 0) break; for (int j=1; j<=M; j++) { for (int k=1; k<=S; k+...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using vi = vector<int>; using ll = long long; constexpr int mod = 100000; int main() { int N, M, S; while(cin >> N >> M >> S, N) { vector<vector<int>> dp(N * N + 1, vector<int>(S + 1)); dp[0][0] = 1; for(int i =...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<algorithm> using namespace std; static const int MAX_N = 7; static const int MAX_M = 2000; static const int MAX_S = 3000; static const int MOD = 100000; int N, M, S; int memo[2][MAX_M + 1][MAX_S + 1]; int main(){ for(;;){ scanf("%d %d %d", &N, &M, &S); if(N == 0 && M ==...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstring> #include<algorithm> using namespace std; #define MAX_N 2000 #define MAX_M 3000 int x[MAX_N + 1][MAX_M + 1]; int y[MAX_N + 1][MAX_M + 1]; int z[50][MAX_M]; int sum = 0; int main() { int n, m, s, d, e, f, g; while (true) { cin >> n >> m >> s; if ((n == 0 && m == 0) && s == 0...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> #include<algorithm> using namespace std; const int mod=100000; int dp[2][2001][3001]; int main(){ int n,m,s; while(cin>>n>>m>>s,n){ fill(dp[0][0],dp[0][0]+2*2001*3001,0); n*=n; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> using namespace std; int main(){ while(1){ int n,m,s; static int dp[2][2002][3002]; for(int i=0;i<2;i++)for(int j=0;j<2002;j++)for(int k=0;k<3002;k++)dp[i][j][k]=0; scanf("%d%d%d",&n,&m,&s); if(n==0&&m==0&&s==0)break; for(int j=0;j<=m;j++)dp[0][j][0]=1; for(int i=1;i<=n*n;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<sstream> #include<cstdio> #include<cstdlib> #include<vector> #include<string> #include<stack> #include<queue> #include<deque> #include<set> #include<map> #include<algorithm> #include<functional> #include<utility> #include<cmath> #include<ctime> #include<complex> using namespace std; #defin...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> int d[50][3001]; int main() { int n, m, s; while (scanf("%d%d%d", &n, &m, &s), n *= n) { memset(d, 0, sizeof(d)); d[0][0] = 1; for (int i = 1; i <= m; i++) for (int j = n; j > 0; j--) for (int k = i; k <= s; k++) (d[j][k] += d[j - 1][k - i]) %= 100000; printf("%d\n", d[n][...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; const int mod = 100000; int main() { while(true) { int n, m, s; scanf("%d%d%d", &n, &m, &s); if(n == 0 && m == 0 && s == 0) break; n = n * n; s -= (0 + (n - 1)) * n / 2; m = min(m, s); static ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m, s; int dp[2][2001][3001]; int main() { while(cin >> n >> m >> s, n){ for(int i=0;i<2;i++){ for(int j=0;j<=m;j++){ fill(dp[i][j], dp[i][j]+s+1, 0); } } dp[0][0][0] = 1; for(int i=0;i<n*n;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int dp[50][3010]; const int mod=100000; int main(){ while(true){ int n,m,s; cin>>n>>m>>s; if(n==0) return 0; int a=n*n; memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int i=1;i<=a;i++){ for(int j=0;j<=s;j++){ if(j-(a-i+1)>=0){ (dp[i]...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; const int mod = 100000; int dp[2][2001][3001]; int main(int argc, char const* argv[]) { int n, m, s; do{ cin >> n >> m >> s; if(n == 0)break; for(int i = 0; i < n * n; i++){ for(int j = 1; j <= m; j++){ for(int k = 1; k <= s; k++){ if(i == 1){ ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; //Bingo public class Main{ void run(){ Scanner sc = new Scanner(System.in); int MOD = 100000; for(;;){ int N = sc.nextInt(), M = sc.nextInt(), S = sc.nextInt(); if((N|M|S)==0)break; N*=N; int[][] dp = new int[N+1][S+1]; dp[0][0] = 1; for(int m=1;m<=M;m++)for(int k=N;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
python3
def main(): while True: N, M, S = map(int, input().split()) if max(N, M, S) == 0: break ans = solve(N, M, S) print(ans) def solve(N, M, S): MOD = 10 ** 5 p = N * N q = M - p T = S - (p * (p + 1)) // 2 dp = [[0 for i in range(T + 1)] for j in range(p...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n,m,s; int main(){ while(true){ cin >> n >> m >> s; if(n==0){ break; } int mod=pow(10,5); n=pow(n,2); m-=n; s-=(n*(n+1))/2; int m3=min(max((s+1)/n+1,1),m); vector<vector<int>> dp(s+...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int dp[2200][3200],_prev[2200][3200],n,m,s; int main(){ while(true){ cin>>n>>s>>m;if(n==0)return 0;n*=n; for(int i=0;i<2200;i++){fill(dp[i],dp[i]+3180,0);fill(_prev[i],_prev[i]+3180,0);} for(int i=0;i<=s;i++)_prev[i][0]=1; for(int i=0;i<n;i++){ for(int j=1;j<=s;j...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
//y09-6 ビンゴ(2回目) #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <time.h> #include <string> #include <vector> #include <map> #include <list> #include <set> #include <stack> #include <queue> #include <cstdlib> #include <algorithm> #include <random> #include <cassert> using namespace...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int N, M, S; while(cin >> N >> M >> S, N){ // dp[i][j]: 場所iで今の合計がjのときの組み合わせ数 vector < vector< int > > dp( N * N + 1, vector< int >( S + 1, 0)); dp[0][0] = 1; for(int i = 1; i <= M; i++){ // 選ぶ数字 for(int j = N * N; j >= 1; j--){ // idx...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include <math.h> #include <assert.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-9; static const double PI = acos(-1.0); #define REP...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define LL long long #define rep(i,n) for(int i=0;i<n;++i) #define per(i,n) for(int i=n;i>0;i--) #define FOR(i,a,b) for(int i=a;i<=b;++i) #define ROF(i,a,b) for(int i=a;i>=b;i--); #define push_back PB; #define pop_back PPB; using namespace std; static const LL INF = 1LL<<61LL; static const doubl...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 1e5; int main() { ios::sync_with_stdio(false), cin.tie(0); int N, M, S; while (cin >> N >> M >> S, N | M | S) { N *= N; vector<vector<int>> dp(S + 1, vector<int>(N + 1)); dp[0][0] = 1; for (int i = 1; i <= M; i++) { auto tmp = dp; for (int...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <vector> #include <iostream> using namespace std; const int mod = 100000; int N, M, S; int main() { while (cin >> N >> M >> S, N) { N *= N; M -= N; S -= N * (N + 1) / 2; vector<vector<int> > dp(M + 1, vector<int>(S + 1, 0)); dp[0][0] = 1; for (int i = 0; i < N; i++) { for (int j = 1; j <= M; j+...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstdlib> #include <algorithm> #include <cstring> #include <queue> #include <vector> #include <functional> #include <map> #include <set> #include <cmath> #include <string> #define SIZE 200005 #define INF 1000000005LL #define MOD 100000 using namespace std; typedef long long int ll; typedef p...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int dp[2][2001][3001]; const int mod = 100000; int main(){ int n,m,s; while(cin >> n >> m >> s){ if(n==0)break; n = n*n; for(int i=0;i<=m;i++){ for(int j=0;j<=s;j++)dp[0][i][j] = 0; } dp[0][0][0] = 1; for(int i=0;i<n;i++){ ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cmath> #include <algorithm> #include <cstring> #include <cstdio> using namespace std; int dp[100][5000]; int const mod=100000; int main(){ int N,M,S; while(scanf("%d%d%d",&N,&M,&S)!=EOF && N|M|S){ memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int i=1; i<=M; ++i){ for(...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> using namespace std; int dp[50][3001]; int main(){ int n, m, s; while(scanf("%d %d %d", &n, &m, &s), n){ memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for(int i=1; i<=m; ++i){ for(int j=n*n; j>0; --j){ for(int l=i; l<=s; ++l){ dp[j][l] = (dp[j][l] + dp[j-1][l-i]) % 1...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define LL long long #define rep(i,n) for(int i=0;i<n;++i) #define per(i,n) for(int i=n;i>0;i--) #define FOR(i,a,b) for(int i=a;i<=b;++i) #define ROF(i,a,b) for(int i=a;i>=b;i--); #define push_back PB; #define pop_back PPB; using namespace std; static const LL INF = 1LL<<61LL; static const doubl...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MOD 100000 int dp[50][3001]; int main(){ int n,m,s; while(scanf("%d%d%d",&n,&m,&s),(n|m|s)){ for(int i = 0; i < n*n+1; i++){ for(int j = 0; j < s+1; j++){ dp[i][j] = 0; } } dp[0][0] = 1; ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> using namespace std; const int MOD = 100000; int main() { int N, M, S; while(cin >> N >> M >> S, N | M | S) { vector<vector<int>> dp(N * N + 1, vector<int>(S + 1, 0)); dp[0][0] = 1; for(int i = 1; i <= M; ++i) for(int j = N * N; j >= 1; --j) for(int ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <iostream> typedef long long int ll; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; int dp[50][3001]; void func(int N,int M,int S,int limit){ for(int ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
python3
def listrep(n,m,s): tab = [[0]*(s+1) for j in range(n+1)] tab[0][0] = 1 for i in range(1,n+1): for k in range(s+1): if i <= k: tab[i][k] += tab[i][k-i] + tab[i-1][k-i] if k-1 >= m: tab[i][k] -= tab[i-1][k-1-m] tab[i][k] %= 100000 ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mod 100000 typedef pair<int, int> P; int n, m, s, ans; int dp[2][2001][3001]; int main() { while(cin >> n >> m >> s && n) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for(int i = 0; i < n * n; ++i) { for(int j = 0; j < ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mod 100000 typedef pair<int, int> P; int n, m, s, ans; int dp[2][2010][3010]; int main() { while(cin >> n >> m >> s && n) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for(int i = 0; i < n * n; ++i) { for(int j = 0; j < ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
python2
DIV = 100000 while 1: n, m, s = map(int, raw_input().split()) if n == 0: break dp = [[0]*(s+1) for i in range(n*n+1)] dp[0][0] = 1 for i in range(1, n*n+1): for j in range(s+1): if j - i >= 0: dp[i][j] = (dp[i][j] + dp[i-1][j-i] + dp[i][j-i]) % DIV if j - m - 1 >= 0: ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 100000; int main() { int N, M, S; while(cin >> N >> M >> S, N || M || S) { int dp[55][3005] = {}; dp[0][0] = 1; for(int p = 1; p <= M; p++) { for(int i = N * N; i >= 0; i--) { for(int j = S; j >= 0;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<cstdio> #include<sstream> #include<iomanip> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #defi...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int D = 100000; int dp[2][50][3001]; int n, m, s; void set(){ int x, y, z; for(x = 0; x < 2; x++){ for(y = 0; y <= n*n; y++){ for(z = 0; z <= s; z++){ dp[x][y][z] = 0; } } } dp[0][0][0] = 1; for(y =...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) int dp[50][3001]; int n, m, s; const int mod = 100000; int main() { while (cin >> n >> m >> s, n || m || s) { n *= n; fill(dp[0], dp[n + 1], 0); ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,j) FOR(i,0,j) int main(){ int N, M, S, dp[60][3010]; while(std::cin >> N >> M >> S, N){ REP(i, 60){ REP(j, 3010){ dp[i][j] = 0; } } dp[0][0] = 1; for(int i...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <sstream> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <cmath> #include <memory.h> #include <cassert> #include <i...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; constexpr int mod = 100000; constexpr int MAX_N = 50; constexpr int MAX_S = 3010; constexpr int MAX_M = 2010; typedef long long LL; int main(){ int N[5],M[5],S[5]; int ret[5]; LL dp[MAX_S][MAX_N]; vector<int> query[MAX_M]; int q=0; for(q=0;;q++){ scanf("%d%d%d",N+q,M+q,S+q...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
// aoj - - 0537 / 2016-03-04 #include<iostream> #include<vector> #include<cassert> #include<string> #include<algorithm> #include<cstdio> #include<cstdlib> #include<cmath> #include<stack> #include<queue> #include<set> #include<map> #include<tuple> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; t...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int dp[2][59][3010]; int main(){ int N,M,S,n2,ii,io; while(1){ cin>>N>>M>>S; if(N==0&&M==0&&S==0)break; n2=N*N; for(int j=0;j<=n2;j++){ for(int k=0;k<=S;k++){ dp[0][j][k]=0; } } dp[0][0][0]=1; for(int i=1;i<=M;i++){ //for(int k=0;k<=n2;k++){// //...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef pair<int,P> P1; typedef pair<P...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> using namespace std; const int M=100000; int main(){ for(int n,m,sum;scanf("%d%d%d",&n,&m,&sum),n;){ n*=n; int dp[50][3001]={}; dp[0][0]=1; for(int d=1;d<=m;d++){ for(int i=n;i>0;i--)for(int s=d;s<=sum;s++){ dp[i][s]+=dp[i-1][s-d]; if(dp[i][s]>=M) dp[i][s]-=M; } } printf("%d...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> #define mod 100000 int n, m, s; int dp[3001][50]; int main() { while (scanf("%d%d%d",&n,&m,&s)) { if (!n&&!m&&!s) break; memset(dp,0,sizeof(dp)); dp[0][0]=1; for (int i=1; i<=m; i++) { for (int j=n*n; j>0; j--) { for (i...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int N, M, S; int dp[50][3001];//dp[i][j][k] i????????°??§ j??????????????????????????° const int MOD = 100000; int main() { while (cin >> N >> M >> S, N * M) { dp[0][0] = 1; for (int m = 1; m <= M ; m++) { for (int n = N * N; n > 0; n--) { for (int s = m; s <= S; s...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <string> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cstdlib> // require abs exit #include <cstdio> // require scanf printf #include <functional> #...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <cstring> #include <algorithm> #include <numeric> #include <functional> #include <string> #include <map> using namespace std; #define rep(i, n) for(int i = 0; i < int(n); i++) #define rrep(i, n) for(int i = int(n) - 1; i >= 0; i--) #define all(co) co.begin(), co.end() con...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" using namespace std; #define int long long #define PB push_back #define PPB pop_back typedef pair<int, int> pii; typedef pair<double, double> pdd; static const int INF = 1LL << 61; static const int MOD = 100000; int dp[55][3005]; signed main() { ios::sync_with_stdio(false); cin.tie(...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<string> #include<algorithm> #include<math.h> #include<queue> #include<set> #include<map> #include<random> #include<functional> #include<utility> typedef long long ll; #define rep(i,n) for(int i=0; i<n; i++) #define pb push_back #define P pair<int, int> #define PLI pair<ll, int> using name...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<iostream> using namespace std; int num[60][3010]; int main(){ int n,m,s; while(scanf("%d %d %d",&n,&m,&s) && (n||m||s)){ n = n*n; for(int i=0;i<=n;i++) for(int j=0;j<=s;j++)num[i][j] = 0; num[0][0] = 1; for(int i=1;i<=m;i++){ for(int j=n-1;j>=0;j--){ for(...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #include <iostream> #include <memory> #include <memory.h> #include <fstream> #include <cmath> #include <math.h> #include <numeric> #include <vector> #include <stack> #include <string> #include <queue> #include <sstream> #include <cstdlib> #include <cassert> #include <cstdio> #include <map> #in...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <stack> #include <cstring> #include <algorithm> using namespace std; #define reep(i,f,t) for(int i=f ; i<int(t) ; ++i) #define rep(i,n) reep(i, 0, n) const int WIDTH = 3001; const int HEIGHT = 51; int main() { int* dp = new int[HEIGHT * WIDTH]; int n, m, s; while(scanf("%d%d%d", &n,...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstring> using namespace std; int main(){ int n,m,s; int dp[50][3001]; while(1){ cin >> n >> m >> s; if(n == 0 && m == 0 && s == 0) break; memset(dp,0,sizeof(dp)); dp[0][0] = 1; for(int i=1;i<=m;i++){ for(int j=n*n;j>0;j--){ for(int l=i;l<=s;l++){ dp[j][l] = (dp[j][...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <algorithm> #pragma warning(disable: 4996) #define MOD 100000 #define MAX_M 2000 #define MAX_S 3000 int N, M, S; int dp[2][MAX_M + 1][MAX_S + 1]; int main() { while (true) { scanf("%d", &N); scanf("%d", &M); scanf("%d", &S); if (N == 0 && M == 0 && S == 0) { break; } for (...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> using namespace std; int n, m, s, dp[50][3001]; int main() { while (scanf("%d%d%d", &n, &m, &s), n) { for (int i = 0; i <= n*n; i++) for (int j = 0; j <= s; j++) dp[i][j] = 0; dp[0][0] = 1; for (int k = 1; k <= m; k++) { for (int i = n*n-1; i >= 0; i--) { for (int j = k; j...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #define mod 100000 using namespace std; int dp[50][3001]; int main(){ int n,m,s; while(scanf("%d %d %d",&n,&m,&s)){ if(n==0&&m==0&&s==0) break; memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int i=1;i<=m;i++){ for(i...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstdio> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define MOD 100000 using namespace std; int N,M,S; int dp[50][3001]; int main() { while(scanf("%d %d %d",&N,&M,&S),N|M|S) { rep(i,N*N+1)rep(j,S+1)dp[i][j] = 0; dp[0][0] = 1; for(int v=1;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <cfloat> #include <ctime> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define int long long int #define rep(a,b,c) for(int a=b;a<c;a++) #define repm(a,b,c) for(int a=(b-1);a>=c;a--) #define pb push_back #define str string #define sf(a) scanfs("%d",&a) #define pb push_back #define mp make_pair #define Fi first #define Se second #define ALL(v) (v).begin(), (v).end(...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; int main() { cin.tie(0); ios::sync_with_stdio(false); while(true){ int n,m,s; cin >> n >> m >> s; if(n == 0) break; int ans = 0; int dp[2][50][3005]; memset(dp,0,sizeof(dp)); dp[0][0][0] = 1; for (int i = ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> using namespace std; #define reps(i,b,n) for(int i = b ; i < n ; ++i ) #define rep(i,n) reps(i,0,n) #define INF (1 << 30) #define MOD 100000 int dp[51][3001],N,M,S; int main(){ while(cin >> N >> M >> S , N){ fill_n(dp[0],51*3001,0); dp[0][0] = 1; for(int i = 1 ; i <=...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <stack> #include <map> #include <algorithm> #include <sstream> #include <queue> #include <string> #include <cstring> #include <cmath> using namespace std; #define F first #define S second const int INF=100000000; int dp[50][3001]; const int mod=100000; int main(){ int n,m,s; while(cin >...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <map> #include <stack> #include <cstring> #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define rep(i, n) for(int i = 0; i < (n); i++) #define MP make_pair #define X first #define Y second using namespace st...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> using namespace std; int main(){ int N,M,S; while(cin>>N>>M>>S,N){ vector<vector<int> > dp(N*N+1,vector<int>(S+1)); dp[0][0]=1; for(int i=0;i<M;i++){ for(int j=N*N-1;j>=0;j--){ for(int k=0;k<S-i;k++){ dp[j+1][k+(i+1)]+=dp[j][k]; dp[j+1][k+(i+1)]%=100000...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstring> using namespace std; const int MAX_N = 7; const int MAX_S = 3000; int dp[MAX_N * MAX_N + 1][MAX_S + 1]; int main() { int N, M, S; while (cin >> N >> M >> S, N) { memset(dp, 0, sizeof dp); N *= N; dp[0][0] = 1; for (int i = 1; i <= M; ++i) { for (int j = N; j ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <string> #include <queue> #include <vector> #include <set> #include <map> #include <algorithm> #include <utility> #include <iomanip> #define ll long long int #define pb push_back #define mk make_pair #define pq priority_queue using namespace std; typedef pair<int, int> P; typedef pair<ll,...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int main () { int n, m, s, dp[50][3001]; while (1) { cin>>n>>m>>s; if (!n) break; n*=n; m=min(m, s); memset(dp, 0, sizeof(dp)); dp[0][0]=1; for (int i=1; i<=n; i++) ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef double db; const ll mod=100000; ll dp[50][3001]; ll N,M,S; int main()...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> using namespace std; int DP[2][2002][3001]; int main(){ int n, m, s; while(true){ cin >> n >> m >> s; if(n == 0){ break; } n *= n; for(int i = 0; i <= m; i++){ for(int j = 0; j <= s; j++){ DP[0][i][j] = 0; DP...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<algorithm> using namespace std; #define rep(i,n) for(i=0;i<n;i++) #define reps(i,n) for(i=1;i<=n;i++) int dp[50][2][3001]; int main(){ int n,m,s,nn,st,i,j,k; int t1=0,t2=1; while(1){ scanf("%d%d%d",&n,&m,&s); if(n==0)break; t1=0; t2=1; n*=n; rep(i,50)rep(j,2)rep(k,s+1)d...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; typedef long long ll; int N,M,S; int inf = 1e5; int dp[2][2010][3010] = {}; int main(){ while(cin >> N >> M >> S && N>0){ for(int i=0;i<=M;i++){ for(int j=0;j<=S;j++){ dp[0][i][j] = 0; dp[1][i][j] = 0; } ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> using namespace std; int main(){ while(1){ int n,m,s; static int dp[2][2002][3002]; for(int i=0;i<2;i++)for(int j=0;j<2002;j++)for(int k=0;k<3002;k++)dp[i][j][k]=0; scanf("%d%d%d",&n,&m,&s); if(n==0&&m==0&&s==0)break; for(int j=0;j<=m;j++)dp[0][j][0]=1; for(int i=1;i<=n*n;...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define mod 100000 int dp[50][3001]; int main(){ int n,m,s; while(scanf("%d%d%d",&n,&m,&s),(n|m|s)){ for(int i = 0; i < n*n+1; i++){ for(int j = 0; j < s+1; j++){ ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <sstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <climits> #include <cfloat> using namespace std; int main() {...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define MOD 100000 #define MAX_N 50 #define MAX_S 3001 typedef long long ll; int main(){ int N,M,S; while(cin >> N >> M >> S, N){ ll dp[MAX_N][MAX_S] = {{}}; dp[0][0] = 1; for(int i = 1 ; i <= M ; i++){ for(int j = N*N ; j > 0 ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
python3
import itertools while 1: n,m,s=map(int,input().split()) if n==0:break dp=[[0 for _ in range(s+1)] for _ in range(n*n+1)] dp[0][0]=1 for i,j in itertools.product(range(1,n*n+1),range(s+1)): if j>=i:dp[i][j]+=dp[i-1][j-i]+dp[i][j-i] if j-m>=1:dp[i][j]-=dp[i-1][j-m-1] dp[i][j]%...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> int dp[50][3001]; int main() { int N,M,S; while(scanf("%d %d %d",&N,&M,&S),N|M|S) { memset(dp,0,sizeof(dp)); dp[0][0]=1; for(int m=1;m<=M;m++) { for(int n=N*N;n>=1;n--) { for(int s=m;s<=S;s++) { dp[n][s]+=dp[n-1][s-m]; if(dp[n][s]>=100000) dp[n][s]-=100000; ...
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstring> using namespace std; int dp[50][3001]; int main() { int n,m,s; while(cin >>n>>m>>s,n) { memset(dp,0,sizeof(dp)); dp[0][0] = 1; for (int i=1; i<=m; ++i) for (int j=n*n; j>0; --j) for (int k=s; k>=i; --k) dp[j][k] = (dp[j][k] + dp[j-1][k-i])%1...