buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <stdio.h> int main(int argc, const char *argv[]) { int n, i, j, k, l, count = 0; while (scanf("%d", &n) != EOF) { count = 0; if (n >= 37) printf("0\n"); else { for (i = 0; i <= 9; i++) for (j = 0; j <= 9; j++) for (k = 0; k <= 9; k++) for (l = 0; l <= 9; l++) if (i + j + k + l == n) { // printf("(%d,%d,%d,%d)\n",i,j,k,l); count++; } } printf("%d\n", count); } return 0; }
#include <stdio.h> int main(int argc, const char *argv[]) { int n, i, j, k, l, count = 0; while (scanf("%d", &n) != EOF) { count = 0; if (n >= 37) printf("%d\n", count); else { for (i = 0; i <= 9; i++) for (j = 0; j <= 9; j++) for (k = 0; k <= 9; k++) for (l = 0; l <= 9; l++) if (i + j + k + l == n) { // printf("(%d,%d,%d,%d)\n",i,j,k,l); count++; } printf("%d\n", count); } } return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 7, 8, 7, 8, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
0
152
#include <stdio.h> int main(void) { int n, a, b, c, d; int count = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b) + (c + d) == n) { count++; } } } } } printf("%d\n", count); } return 0; }
#include <stdio.h> int main(void) { int n, a, b, c, d; int count = 0; while (scanf("%d", &n) != EOF) { count = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { count++; } } } } } printf("%d\n", count); } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 15, 23, 0, 16, 31, 16, 31, 23, 0, 25], ["-", 15, 23, 0, 16, 31, 16, 12, 23, 0, 24]]
0
135
#include <stdio.h> int main(void) { int a, b, c, d; int n; int x = 0; int y = 0; int ans; while (scanf("%d", &n) != EOF) { ans = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { ans++; } } } } } } printf("%d\n", ans); return 0; }
#include <stdio.h> int main(void) { int a, b, c, d; int n; int x = 0; int y = 0; int ans; while (scanf("%d", &n) != EOF) { ans = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { ans++; } } } } } printf("%d\n", ans); } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
0
146
#include <stdio.h> int main(void) { int a, b, c, d, n; int i, j, l, k; int p = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) { p++; } } } } } printf("%d\n", p); } return (0); }
#include <stdio.h> int main(void) { int a, b, c, d, n; int i, j, l, k; int p = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) { p++; } } } } } printf("%d\n", p); p = 0; } return (0); }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
142
#include <stdio.h> int main(void) { int n, a, b, c, d, sum, key; while (scanf("%d", &n) != EOF) { key = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (n == a + b + c + d) { key++; } } } } } printf("%d", key); } return 0; }
#include <stdio.h> int main(void) { int n, a, b, c, d, sum, key; while (scanf("%d", &n) != EOF) { key = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (n == a + b + c + d) { key++; } } } } } printf("%d\n", key); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
133
i, a, d, e; main(n) { for (; ~scanf("%d", &n); printf("%d\n", a)) for (i = 0, a = d = 1, e = 2, n > 18 && (n = 36 - n); i < n; e += i++ < 8 ? 1 : -3, a += d) d += e; }
i, a, d, e; main(n) { for (; ~scanf("%d", &n); printf("%d\n", n < 0 ? 0 : a)) for (i = 0, a = d = 1, e = 2, n > 18 && (n = 36 - n); i < n; e += i++ < 8 ? 1 : -3, a += d) d += e; }
[["+", 26, 2, 3, 4, 0, 41, 15, 16, 31, 22], ["+", 26, 2, 3, 4, 0, 41, 15, 16, 17, 18], ["+", 26, 2, 3, 4, 0, 41, 15, 16, 12, 13], ["+", 0, 7, 26, 2, 3, 4, 0, 41, 0, 101], ["+", 0, 7, 26, 2, 3, 4, 0, 41, 64, 13], ["+", 0, 7, 26, 2, 3, 4, 0, 41, 0, 102]]
0
89
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { int i, j, k, l, count; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (n == i + j + k + l) count++; } } } } printf("%d\n", count); } return 0; }
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { int i, j, k, l, count; count = 0; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (n == i + j + k + l) count++; } } } } printf("%d\n", count); } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
126
#include <stdio.h> int main(void) { int a, b, c, d, n, count; while (1) { if (scanf("%d", &n) == EOF) break; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) count++; } } } } printf("%d\n", count); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, n, count; while (1) { count = 0; if (scanf("%d", &n) == EOF) break; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) count++; } } } } printf("%d\n", count); } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
132
#include <iostream> using namespace std; int main() { int L = 0, N, A, B, C, D; while (cin >> N) { for (A = 0; A < 10; A++) { for (B = 0; B < 10; B++) { for (C = 0; C < 10; C++) { for (D = 0; D < 10; D++) { if (A + B + C + D == N) { L++; }; }; }; }; }; cout << L << endl; }; cin >> L; return 0; }
#include <iostream> using namespace std; int main() { int L = 0, N, A, B, C, D; while (cin >> N) { L = 0; for (A = 0; A < 10; A++) { for (B = 0; B < 10; B++) { for (C = 0; C < 10; C++) { for (D = 0; D < 10; D++) { if (A + B + C + D == N) { L++; }; }; }; }; }; cout << L << endl; }; cin >> L; return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
131
#include <iostream> using namespace std; int main() { int n, count; int a, b, c, d; while (cin >> n) { // a>=b>=c>=dと仮定 count = 0; for (a = 0; a < 10; a++) { if (a > n) continue; for (b = 0; b < a + 1; b++) { if (a + b > n) continue; for (c = 0; c < b + 1; c++) { if (a + b + c > n) continue; d = n - a - b - c; if (d > c) continue; if (a == d) //全部同じ count += 1; else if (a == c || b == d) //1つ異なる count += 4; else if (a == b && c == d) // 2つずつ同じ count += 6; else if (a == b || b == c || c == d) // 2つ同じ count += 12; } } } cout << count << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, count; int a, b, c, d; while (cin >> n) { // a>=b>=c>=dと仮定 count = 0; for (a = 0; a < 10; a++) { if (a > n) continue; for (b = 0; b < a + 1; b++) { if (a + b > n) continue; for (c = 0; c < b + 1; c++) { if (a + b + c > n) continue; d = n - a - b - c; if (d > c) continue; if (a == d) //全部同じ count += 1; else if (a == c || b == d) //1つ異なる count += 4; else if (a == b && c == d) // 2つずつ同じ count += 6; else if (a == b || b == c || c == d) // 2つ同じ count += 12; else count += 24; } } } cout << count << endl; } return 0; }
[["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 57, 75, 76, 0, 1, 0, 35]]
1
208
#include <iostream> using namespace std; int main(void) { int c; while (cin >> c) { int cnt = 0; for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) for (int k = 0; k < 10; k++) for (int l = 0; l < 10; l++) if (i * j * k * l == c) cnt++; cout << cnt << endl; } return 0; }
#include <iostream> using namespace std; int main(void) { int c; while (cin >> c) { int cnt = 0; for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) for (int k = 0; k < 10; k++) for (int l = 0; l < 10; l++) if (i + j + k + l == c) cnt++; cout << cnt << endl; } return 0; }
[["-", 51, 16, 31, 16, 31, 16, 31, 16, 17, 48], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 48], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 72], ["-", 8, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 8, 57, 15, 339, 51, 16, 31, 16, 17, 72]]
1
109
#include <iostream> #include <string> using namespace std; int main() { int a[5][51]; int b; int c; int d; b = 1; while (b < 5) { c = 0; while (c < 51) { a[b][c] = 0; c = c + 1; } b = b + 1; } b = 0; while (b < 10) { a[1][b] = 1; b = b + 1; } b = 2; while (b < 5) { c = 0; while (c < 51) { d = 0; while (d < 9) { if (c >= d) { a[b][c] = a[b][c] + a[b - 1][c - d]; } d = d + 1; } c = c + 1; } b = b + 1; } int n; while (cin >> n) { cout << a[4][n] << endl; } }
#include <iostream> #include <string> using namespace std; int main() { int a[5][51]; int b; int c; int d; b = 1; while (b < 5) { c = 0; while (c < 51) { a[b][c] = 0; c = c + 1; } b = b + 1; } b = 0; while (b < 10) { a[1][b] = 1; b = b + 1; } b = 2; while (b < 5) { c = 0; while (c < 51) { d = 0; while (d < 10) { if (c >= d) { a[b][c] = a[b][c] + a[b - 1][c - d]; } d = d + 1; } c = c + 1; } b = b + 1; } int n; while (cin >> n) { cout << a[4][n] << endl; } }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
219
#include <iostream> using namespace std; int main() { int num; int a, b, c, d, cnt = 0; while (cin >> num, !cin.eof()) { for (a = 0; a < 10; a++) for (b = 0; b < 10; b++) for (c = 0; c < 10; c++) for (d = 0; d < 10; d++) if (a + b + c + d == num) cnt++; cout << cnt << endl; } return 0; }
#include <iostream> using namespace std; int main() { int num; int a, b, c, d, cnt = 0; while (cin >> num, !cin.eof()) { cnt = 0; for (a = 0; a < 10; a++) for (b = 0; b < 10; b++) for (c = 0; c < 10; c++) for (d = 0; d < 10; d++) if (a + b + c + d == num) cnt++; cout << cnt << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
119
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define rep(n) REP(i, n) int main() { int n; while (cin >> n) { int ans = 0; REP(i, 10) REP(j, 10) REP(k, 10) { if ((i + j + k) < n && (i + j + k) + 9 >= n) ++ans; } cout << ans << endl; } return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define rep(n) REP(i, n) int main() { int n; while (cin >> n) { int ans = 0; REP(i, 10) REP(j, 10) REP(k, 10) { if ((i + j + k) <= n && (i + j + k) + 9 >= n) ++ans; } cout << ans << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19]]
1
109
#include <iostream> using namespace std; int main() { int n; int a, b, c, d; int combsum = 0; while (cin >> n) { for (a = 0; a <= 9; a++) for (b = 0; b <= 9; b++) for (c = 0; c <= 9; c++) for (d = 0; d <= 9; d++) if (a + b + c + d == n) combsum++; cout << combsum << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n; int a, b, c, d; int combsum = 0; while (cin >> n) { for (a = 0; a <= 9; a++) for (b = 0; b <= 9; b++) for (c = 0; c <= 9; c++) for (d = 0; d <= 9; d++) if (a + b + c + d == n) combsum++; cout << combsum << endl; combsum = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
113
#include <iostream> using namespace std; int main() { int a, b, c, d, n; while (cin >> n) { int count = 0; if (n <= 36) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { count++; } } } } } cout << count << endl; } else if (n > 37) { cout << 0 << endl; } } return (0); }
#include <iostream> using namespace std; int main() { int a, b, c, d, n; while (cin >> n) { int count = 0; if (n <= 36) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { count++; } } } } } cout << count << endl; } else if (n > 36) { cout << 0 << endl; } } return (0); }
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13]]
1
149
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c, d, n, count = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == n) count++; } } } } cout << count << endl; } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c, d, n, count = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == n) count++; } } } } cout << count << endl; count = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
131
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int sum = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) { sum++; } } } } } cout << sum; } return 0; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int sum = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) { sum++; } } } } } cout << sum << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
116
#include <algorithm> #include <iostream> #include <string> int main() { int n, x; int i, j, k, l; while (std::cin >> n) { x = 0; for (i = 1; i < 10; i++) { for (j = 1; j < 10; j++) { for (k = 1; k < 10; k++) { for (l = 1; l < 10; l++) { if (n == i + j + k + l) { x++; } } } } } std::cout << x << std::endl; } }
#include <algorithm> #include <iostream> #include <string> int main() { int n, x; int i, j, k, l; while (std::cin >> n) { x = 0; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (n == i + j + k + l) { x++; } } } } } std::cout << x << std::endl; } }
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13]]
1
127
#include <iostream> using namespace std; int main() { int num; cin >> num; while (cin >> num) { int answer = 0; for (int a = 0; a != 10; ++a) { for (int b = 0; b != 10; ++b) { for (int c = 0; c != 10; ++c) { for (int d = 0; d != 10; ++d) if (a + b + c + d == num) answer++; } } } cout << answer << endl; } return 0; }
#include <iostream> using namespace std; int main() { int num; while (cin >> num) { int answer = 0; for (int a = 0; a != 10; ++a) { for (int b = 0; b != 10; ++b) { for (int c = 0; c != 10; ++c) { for (int d = 0; d != 10; ++d) if (a + b + c + d == num) answer++; } } } cout << answer << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
118
#include <cstdio> #include <iostream> using namespace std; int main(void) { int n; while (scanf("%d", &n) != EOF) { int count = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == 35) count++; } } } } cout << count << endl; } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main(void) { int n; while (scanf("%d", &n) != EOF) { int count = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) count++; } } } } cout << count << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
127
#include <cstdio> using namespace std; int main(void) { int i, j, k, l, ans = 0, n; while (scanf("%d", &n) != EOF) { for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == n) { ans++; } } } } } printf("%d\n", ans); } return 0; }
#include <cstdio> using namespace std; int main(void) { int i, j, k, l, ans, n; while (scanf("%d", &n) != EOF) { ans = 0; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == n) { ans++; } } } } } printf("%d\n", ans); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
134
#include <stdio.h> int main(void) { int n; int a, b, c, d; int cnt; int i, j, k, l; while (scanf("%d", &n) != EOF) { cnt = 0; if (n <= 36) { for (i = 1; i < 10; i++) { for (j = 1; j < 10; j++) { for (k = 1; k < 10; k++) { for (l = 1; l < 10; l++) { if (i + j + k + l == n) cnt++; } } } } printf("%d\n", cnt); } else printf("0\n"); } return 0; }
#include <stdio.h> int main(void) { int n; int a, b, c, d; int cnt; int i, j, k, l; while (scanf("%d", &n) != EOF) { cnt = 0; if (n <= 36) { for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == n) cnt++; } } } } printf("%d\n", cnt); } else printf("0\n"); } return 0; }
[["-", 0, 57, 64, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13]]
1
158
#include <iostream> using namespace std; int main() { int n, t; int out[100] = {0}; while (cin >> n) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) { out[t]++; } } } } } t++; } for (int i = 0; i < t; i++) { cout << out[t] << endl; } }
#include <iostream> using namespace std; int main() { int n, t = 0; int out[100] = {0}; while (cin >> n) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) { out[t]++; } } } } } t++; } for (int i = 0; i < t; i++) { cout << out[i] << endl; } }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
147
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int a, b, c, d, n, k; cin >> n; k = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { k = k + 1; } } } } } cout << k << endl; return 0; }
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int a, b, c, d, n, k; while (cin >> n) { k = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { k = k + 1; } } } } } cout << k << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
126
#include <iostream> using namespace std; int main() { int num; int c = 0; while (cin >> num) { c = 0; if (num > 36 || num < 0) { cout << 0 << endl; continue; } else { for (int i = 0; i <= 9; i++) for (int j = 0; j <= 9; j++) for (int k = 0; k <= 9; k++) for (int v = 0; v <= 9; v++) { if (i + j + k + v == num) c++; } } } cout << c << endl; return 0; }
#include <iostream> using namespace std; int main() { int num; int c = 0; while (cin >> num) { c = 0; if (num > 36 || num < 0) { cout << 0 << endl; continue; } else { for (int i = 0; i <= 9; i++) for (int j = 0; j <= 9; j++) for (int k = 0; k <= 9; k++) for (int v = 0; v <= 9; v++) { if (i + j + k + v == num) c++; } cout << c << endl; } } return 0; }
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
137
#include <iostream> using namespace std; int seach(int n, int m) { if (m == 4) { return (n == 0); } else { int res = 0; for (int i = 0; i < 10; i++) { res += seach(n - i, m + 1); } return res; } } int main() { int n; cin >> n; cout << seach(n, 0) << endl; return 0; }
#include <iostream> using namespace std; int seach(int n, int m) { if (m == 4) { return (n == 0); } else { int res = 0; for (int i = 0; i < 10; i++) { res += seach(n - i, m + 1); } return res; } } int main() { int n; while (cin >> n) cout << seach(n, 0) << endl; return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25]]
1
99
while line = gets number = line.chomp.to_i puts 0 if number > 36 counter = 0 (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| counter += 1 if (a + b + c + d) == number end end end end puts counter end
while line = gets number = line.chomp.to_i if number > 36 puts 0 else counter = 0 (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| counter += 1 if (a + b + c + d) == number end end end end puts counter end end
[["-", 0, 89, 8, 170, 0, 751, 8, 652, 735, 22], ["-", 8, 170, 0, 751, 8, 652, 3, 4, 0, 612], ["+", 8, 170, 0, 121, 64, 749, 0, 652, 735, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["+", 0, 89, 8, 170, 0, 121, 75, 95, 0, 95], ["+", 0, 493, 0, 89, 8, 170, 0, 121, 0, 444]]
4
86
n = gets.chomp.to_i ans = 0 i = 0 while i <= 9 j = 0 while j <= 9 k = 0 while k <= 9 l = 0 while l <= 9 ans += 1 if i + j + k + l == n l += 1 end k += 1 end j += 1 end i += 1 end puts ans
while n = gets n = n.chomp.to_i ans = 0 i = 0 while i <= 9 j = 0 while j <= 9 k = 0 while k <= 9 l = 0 while l <= 9 ans += 1 if i + j + k + l == n l += 1 end k += 1 end j += 1 end i += 1 end puts ans end
[["+", 36, 36, 36, 36, 0, 493, 0, 89, 0, 89], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 444]]
4
69
# Sum of 4 Integers x = Array.new(50, 0) i = j = k = l = 10 i.times { |i| j.times { |j| k.times { |k| l.times { |l| x[i + j + k + l] += 1 } } } } while line = ARGF.gets puts x[line.to_i] end
# Sum of 4 Integers x = Array.new(51, 0) i = j = k = l = 10 i.times { |i| j.times { |j| k.times { |k| l.times { |l| x[i + j + k + l] += 1 } } } } while line = ARGF.gets puts x[line.to_i] end
[["-", 0, 493, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 612]]
4
78
while n = gets n.chomp.to_i m = 0 (0..9).each do |i| (0..9).each do |j| (0..9).each do |k| (0..9).each do |l| m += 1 if i + j + k + l == n end end end end puts m end
while n = gets n = n.chomp.to_i m = 0 (0..9).each do |i| (0..9).each do |j| (0..9).each do |k| (0..9).each do |l| m += 1 if i + j + k + l == n end end end end puts m end
[["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 486, 22]]
4
76
cnt = 0 while line = gets n = line.to_i if n > 36 puts 0 else (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| cnt += 1 if a + b + c + d == n end end end end puts cnt end end
while line = gets n = line.to_i cnt = 0 if n > 36 puts 0 else (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| cnt += 1 if a + b + c + d == n end end end end puts cnt end end
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 12, 612]]
4
84
$stdin.gets.split("\n").map(&:chomp).map(&:to_i).each do |n| count = 0 10.times do |a| 10.times do |b| 10.times do |c| 10.times do |d| count += 1 if a + b + c + d == n end end end end puts count end
$stdin.read.split("\n").map(&:chomp).map(&:to_i).each do |n| count = 0 10.times do |a| 10.times do |b| 10.times do |c| 10.times do |d| count += 1 if a + b + c + d == n end end end end puts count end
[["-", 486, 652, 486, 652, 486, 652, 486, 652, 735, 22], ["+", 486, 652, 486, 652, 486, 652, 486, 652, 735, 22]]
4
79
#!/usr/local/bin/ruby n = gets.to_i m = 0 (0..9).to_a.repeated_permutation(4) do |a, b, c, d| m += 1 if a + b + c + d == n end puts m.to_s
#!/usr/local/bin/ruby while line = gets n = line.to_i m = 0 (0..9).to_a.repeated_permutation(4) do |a, b, c, d| m += 1 if a + b + c + d == n end puts m.to_s end
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 89, 0, 89], ["+", 36, 36, 0, 493, 0, 89, 15, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 444]]
4
49
#!/usr/local/bin/ruby n = gets.to_i count = 0 (0..9).to_a.repeated_permutation(4) do |a, b, c, d| if a + b + c + d == n # printf("(%d, %d, %d, %d)\n",a,b,c,d) count += 1 end end puts count
#!/usr/local/bin/ruby while line = gets n = line.to_i count = 0 (0..9).to_a.repeated_permutation(4) do |a, b, c, d| if a + b + c + d == n # printf("(%d, %d, %d, %d)\n",a,b,c,d) count += 1 end end puts count end
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 89, 0, 89], ["+", 36, 36, 0, 493, 0, 89, 15, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 444]]
4
49
def fact(n) if n.zero? 1 else n * fact(n - 1) end end def c(n, r) fact(n) / (fact(n - r) * fact(r)) end def calcCombine(n) n = 36 - n if (n >= 0) && (n <= 9) c(n + 3, 3) elsif (n >= 10) && (n <= 18) c(n + 3, 3) - 4 * c(n - 7, 3) else 0 end end input = [] while (line = gets) != nil input.push(line.to_i) end input.each do |i| puts calcCombine(i) end
def fact(n) if n.zero? 1 else n * fact(n - 1) end end def c(n, r) fact(n) / (fact(n - r) * fact(r)) end def calcCombine(n) n = n > 18 ? 36 - n : n if (n >= 0) && (n <= 9) c(n + 3, 3) elsif (n >= 10) && (n <= 18) c(n + 3, 3) - 4 * c(n - 7, 3) else 0 end end input = [] while (line = gets) != nil input.push(line.to_i) end input.each do |i| puts calcCombine(i) end
[["+", 8, 736, 0, 662, 12, 754, 15, 738, 31, 22], ["+", 8, 736, 0, 662, 12, 754, 15, 738, 17, 47], ["+", 8, 736, 0, 662, 12, 754, 15, 738, 12, 612], ["+", 0, 735, 8, 736, 0, 662, 12, 754, 0, 101], ["+", 8, 736, 0, 662, 12, 754, 64, 738, 12, 22], ["+", 0, 735, 8, 736, 0, 662, 12, 754, 0, 102]]
4
146
count = [] (0..36).each do |num| count[num] = 0 (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| count[num] += 1 if a + b + c + d == n end end end end end def answer(n) if n.negative? || (n > 36) 0 else count[n] end end while n = gets puts answer(n.to_i) end
$count = [] (0..36).each do |num| $count[num] = 0 (0..9).each do |a| (0..9).each do |b| (0..9).each do |c| (0..9).each do |d| $count[num] += 1 if a + b + c + d == num end end end end end def answer(n) if n.negative? || (n > 36) 0 else $count[n] end end while n = gets puts answer(n.to_i) end
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 744], ["-", 196, 737, 8, 736, 0, 662, 31, 742, 500, 22], ["+", 196, 737, 8, 736, 0, 662, 31, 742, 500, 744], ["-", 8, 736, 0, 751, 8, 755, 31, 742, 500, 22], ["+", 8, 736, 0, 751, 8, 755, 31, 742, 500, 744], ["-", 196, 737, 8, 736, 0, 751, 15, 738, 12, 22], ["+", 196, 737, 8, 736, 0, 751, 15, 738, 12, 22], ["-", 8, 736, 0, 121, 75, 95, 0, 742, 500, 22], ["+", 8, 736, 0, 121, 75, 95, 0, 742, 500, 744]]
4
121
#define _CRT_SECURE_NO_WARNINGS #define M_PI 3.14159265358979 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, counter = 0; while (scanf("%d", &n) == -1) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) counter++; } } } } cout << counter << endl; } return 0; }
#define _CRT_SECURE_NO_WARNINGS #define M_PI 3.14159265358979 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int n, counter = 0; while (scanf("%d", &n) != -1) { counter = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) counter++; } } } } cout << counter << endl; } return 0; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
142
#include <cstdio> #include <iostream> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF) { int cou = 0; cin >> n; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == n) { cou++; } } } } } cout << cou << "\n"; } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF) { int cou = 0; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == n) { cou++; } } } } } cout << cou << "\n"; } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
134
#include <iostream> using namespace std; int main() { int n, count = 0; while (cin >> n) { for (int a = 0; a <= 9; a++) for (int b = 0; b <= 9; b++) for (int c = 0; c <= 9; c++) for (int d = 0; d <= 9; d++) if (a + b + c + d == n) count++; cout << count << endl; } }
#include <iostream> using namespace std; int main() { int n, count = 0; while (cin >> n) { for (int a = 0; a <= 9; a++) for (int b = 0; b <= 9; b++) for (int c = 0; c <= 9; c++) for (int d = 0; d <= 9; d++) if (a + b + c + d == n) count++; cout << count << endl; count = 0; } }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
104
#include <iostream> using namespace std; int main() { int n, a; while (cin >> n) { int x = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { for (int k = 0; k < 9; k++) { a = n - i - j - k; if (a >= 0 && a <= 9) x++; } } } cout << x << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, a; while (cin >> n) { int x = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { a = n - i - j - k; if (a >= 0 && a <= 9) x++; } } } cout << x << endl; } return 0; }
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
110
#include <stdio.h> int main() { int i, j, k, l, cou, n; while (scanf("%d", &n) != EOF) { cou = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) cou++; } } } } } printf("%d\n", cou); return 0; }
#include <stdio.h> int main() { int i, j, k, l, cou, n; while (scanf("%d", &n) != EOF) { cou = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) cou++; } } } } printf("%d\n", cou); } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
129
#include <iostream> using namespace std; int main() { int n; cin >> n; int count = 0; for (int a = 0; a <= 9; ++a) { for (int b = 0; b <= 9; ++b) { for (int c = 0; c <= 9; ++c) { for (int d = 0; d <= 9; ++d) { if (a + b + c + d == n) { ++count; } } } } } cout << count << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int count = 0; for (int a = 0; a <= 9; ++a) { for (int b = 0; b <= 9; ++b) { for (int c = 0; c <= 9; ++c) { for (int d = 0; d <= 9; ++d) { if (a + b + c + d == n) { ++count; } } } } } cout << count << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
114
#include <iostream> using namespace std; int main() { int s; while (cin >> s) { int c = 0; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if ((i + j + k + l) == s) { c++; } } } } } cout << c; } }
#include <iostream> using namespace std; int main() { int s; while (cin >> s) { int c = 0; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if ((i + j + k + l) == s) { c++; } } } } } cout << c << endl; } }
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
115
#include <iostream> using namespace std; int main() { int n; cin >> n; int counter = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { if (0 <= n - a - b - c && n - a - b - c <= 9) { counter++; } } } } cout << counter << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int counter = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { if (0 <= n - a - b - c && n - a - b - c <= 9) { counter++; } } } } cout << counter << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
108
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int cnt; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) cnt++; } } } } cout << cnt << endl; } }
#include <iostream> using namespace std; int main() { int n, cnt; while (cin >> n) { cnt = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) cnt++; } } } } cout << cnt << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
1
111
#include <algorithm> #include <iostream> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <utility> #include <vector> int n; using namespace std; int main() { std::ios::sync_with_stdio(false); while (cin >> n) { int counter = 0; for (int i = 0; i <= 9; i++) { for (int k = 0; k <= 9; k++) { for (int j = 0; j <= 9; j++) { for (int p = 0; p <= 9; p++) { if (n == i + k + j + p) { counter++; } } } } } cout << counter; } return 0; }
#include <algorithm> #include <iostream> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <utility> #include <vector> int n; using namespace std; int main() { std::ios::sync_with_stdio(false); while (cin >> n) { int counter = 0; for (int i = 0; i <= 9; i++) { for (int k = 0; k <= 9; k++) { for (int j = 0; j <= 9; j++) { for (int p = 0; p <= 9; p++) { if (n == i + k + j + p) { counter++; // break; } } } } } cout << counter << "\n"; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
139
#include <iostream> using namespace std; int main() { int a, b, c, d, n; int x = 0; while (cin >> n) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) { x++; } } } } } cout << x << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, d, n; int x = 0; while (cin >> n) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) { x++; } } } } } cout << x << endl; x = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
126
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, a, ans = 0; while (cin >> n) { rep(i, 10) { rep(j, 10) { rep(k, 10) { a = n - i - j - k; if (a >= 0 && a < 10) { ans++; } } } } cout << ans << endl; } }
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, a, ans = 0; while (cin >> n) { rep(i, 10) { rep(j, 10) { rep(k, 10) { a = n - i - j - k; if (a >= 0 && a < 10) { ans++; } } } } cout << ans << endl; ans = 0; } }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
92
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int count = 0; if (n <= 36) { for (int a = 0; a <= n; a++) { for (int b = 0; b <= n; b++) { for (int c = 0; c <= n; c++) { for (int d = 0; d <= n; d++) { if (a + b + c + d == n) { count++; } } } } } } cout << count << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int count = 0; if (n <= 36) { for (int a = 0; a <= 9; a++) { for (int b = 0; b <= 9; b++) { for (int c = 0; c <= 9; c++) { for (int d = 0; d <= 9; d++) { if (a + b + c + d == n) { count++; } } } } } } cout << count << endl; } return 0; }
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
126
#include <algorithm> #include <iostream> using namespace std; int main() { int n; while (cin >> n) { int a; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == n) a += 1; } } } } cout << a << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; while (cin >> n) { int a = 0; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == n) a += 1; } } } } cout << a << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
117
#include <iostream> #include <string> using namespace std; int main() { int a = 0, b = 0; while (cin >> a) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == a) { b++; } } } } } } cout << b << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int a = 0, b = 0; while (cin >> a) { b = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == a) { b++; } } } } } cout << b << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
121
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main(void) { // n<=50 int n, i, j, k, l, cnt; while (cin >> n) { cnt = 0; for (i = 0; i <= 9; i++) { for (j = i; j <= 9; j++) { for (k = j; k <= 9; k++) { for (l = k; l <= 9; l++) if (i + j + k + l == n) cnt += 4; } } } cout << cnt << endl; } return 0; }
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int main(void) { // n<=50 int n, i, j, k, l, cnt; while (cin >> n) { cnt = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) if (i + j + k + l == n) cnt++; } } } cout << cnt << endl; } return 0; }
[["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 57, 64, 1, 0, 11, 17, 107], ["-", 0, 7, 8, 57, 64, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 57, 64, 1, 0, 27, 17, 29]]
1
126
#include <algorithm> #include <iostream> using namespace std; int main() { int a; while (cin >> a) { cin >> a; int b = 0; for (int c = 0; c < 10; c++) for (int d = 0; d < 10; d++) for (int e = 0; e < 10; e++) for (int f = 0; f < 10; f++) { if (c + d + e + f == a) b = b + 1; } cout << b << endl; } }
#include <algorithm> #include <iostream> using namespace std; int main() { int a; while (cin >> a) { int b = 0; for (int c = 0; c < 10; c++) for (int d = 0; d < 10; d++) for (int e = 0; e < 10; e++) for (int f = 0; f < 10; f++) { if (c + d + e + f == a) b = b + 1; } cout << b << endl; } }
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
116
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0008 #include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int ans = 0; for (int a = 0; a <= 9; a++) { for (int b = 0; b <= 9; b++) { for (int c = 0; c <= 9; c++) { for (int d = 0; d <= 9; d++) { if (a + b + c + d == n) ans++; } } } } cout << ans << endl; }
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0008 #include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; while (cin >> n) { int ans = 0; for (int a = 0; a <= 9; a++) { for (int b = 0; b <= 9; b++) { for (int c = 0; c <= 9; c++) { for (int d = 0; d <= 9; d++) { if (a + b + c + d == n) ans++; } } } } cout << ans << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
124
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <functional> #include <iostream> #include <numeric> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int count = 0, num; while (cin >> num) { num = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == num) count++; } } } } cout << count << endl; } }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <functional> #include <iostream> #include <numeric> #include <sstream> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int count = 0, num; while (cin >> num) { count = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == num) count++; } } } } cout << count << endl; } }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
138
#include <iostream> #include <stdio.h> using namespace std; int main() { int n = 0; int C = 0; int a, b, c, d; while (scanf("%d", &n) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { C++; } } } } } cout << C << endl; } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main() { int n = 0; int C = 0; int a, b, c, d; while (scanf("%d", &n) != EOF) { C = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { C++; } } } } } cout << C << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
135
#include "bits/stdc++.h" using namespace std; int main() { int x; cin >> x; int ans = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == x) ans++; } } } } cout << ans << endl; }
#include "bits/stdc++.h" using namespace std; int main() { int x; while (cin >> x) { int ans = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == x) ans++; } } } } cout << ans << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
111
#include <iostream> using namespace std; int main() { int n, i, j, k, l, C = 0; while (cin >> n) { C = 0; for (i = 1; i < 10; i++) { for (j = 1; j < 10; j++) { for (k = 1; k < 10; k++) { for (l = 1; l < 10; l++) { if (n == i + j + k + l) { C = C + 1; } } } } } cout << C << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, i, j, k, l, C = 0; while (cin >> n) { C = 0; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (n == i + j + k + l) { C = C + 1; } } } } } cout << C << endl; } return 0; }
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13]]
1
128
#include <iostream> using namespace std; #define RENT 100000 int main() { int n, ans; int counter = 0; while (cin >> n) { ans = 0; for (int i = 0; i < 10; i++) { for (int q = 0; q < 10; q++) { for (int w = 0; w < 10; w++) { for (int e = 0; e < 10; e++) { ans = i + q + w + e; if (ans == n) { counter += 1; } } } } } cout << counter << endl; } }
#include <iostream> using namespace std; #define RENT 100000 int main() { int n, ans; int counter = 0; while (cin >> n) { counter = 0; for (int i = 0; i < 10; i++) { for (int q = 0; q < 10; q++) { for (int w = 0; w < 10; w++) { for (int e = 0; e < 10; e++) { ans = i + q + w + e; if (ans == n) { counter += 1; } } } } } cout << counter << endl; } }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
129
#include <bits/stdc++.h> using namespace std; int a, b, x; int mySet(int d) { for (int i = 0; i < 10; i++) { if (d < 3) { mySet(d + 1); } else if (d == 3) { if (a == x) { b++; } } a++; } return a = a - 10; } int main(void) { while (scanf("%d", &x) != EOF) { mySet(0); cout << b << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, x; int mySet(int d) { for (int i = 0; i < 10; i++) { if (d < 3) { mySet(d + 1); } else if (d == 3) { if (a == x) { b++; } } a++; } return a = a - 10; } int main(void) { while (scanf("%d", &x) != EOF) { mySet(0); cout << b << endl; b = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
119
#include <iostream> #include <vector> using namespace std; int main() { int N; int count = 0; while (cin >> N) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { int s = a + b + c + d; if (s == N) count++; else if (s > N) break; } } } } } cout << count << endl; return 0; }
#include <iostream> #include <vector> using namespace std; int main() { int N; int count = 0; while (cin >> N) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { int s = a + b + c + d; if (s == N) count++; else if (s > N) break; } } } } cout << count << endl; count = 0; } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
132
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main(void) { int n, ans, i, j, k, l; cin >> n; ans = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) { ans++; } } } } } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main(void) { int n, ans, i, j, k, l; while (cin >> n) { ans = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) { ans++; } } } } } cout << ans << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
142
#include <iostream> using namespace std; int main(void) { int a, b = 0; while (cin >> a) { for (int A = 0; A < 10; A++) { for (int B = 0; B < 10; B++) { for (int C = 0; C < 10; C++) { for (int D = 0; D < 10; D++) { if (A + B + C + D == a) b++; } } } } } cout << b << endl; return 0; }
#include <iostream> using namespace std; int main(void) { int a, b = 0; while (cin >> a) { for (int A = 0; A < 10; A++) { for (int B = 0; B < 10; B++) { for (int C = 0; C < 10; C++) { for (int D = 0; D < 10; D++) { if (A + B + C + D == a) b++; } } } } cout << b << endl; b = 0; } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
116
#include <iostream> using namespace std; int N; int solve() { int ans = 0; for (int i = 0; i <= 9; ++i) { for (int j = 0; j <= 9; ++j) { for (int k = 0; k <= 9; ++k) { for (int l = 0; l <= 9; ++l) { int tmp = i + j + k + l; if (tmp == N) ans++; } } } } return ans; } int main() { cin >> N; int ans = solve(); cout << ans << endl; }
#include <iostream> using namespace std; int N; int solve() { int ans = 0; for (int i = 0; i <= 9; ++i) { for (int j = 0; j <= 9; ++j) { for (int k = 0; k <= 9; ++k) { for (int l = 0; l <= 9; ++l) { int tmp = i + j + k + l; if (tmp == N) ans++; } } } } return ans; } int main() { while (cin >> N) { int ans = solve(); cout << ans << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
130
#include <iostream> using namespace std; int main(void) { int cnt = 0, n; while (cin >> n) { for (int a = 0; a <= 9; ++a) for (int b = 0; b <= 9; ++b) for (int c = 0; c <= 9; ++c) for (int d = 0; d <= 9; ++d) if (a + b + c + d == n) ++cnt; cout << cnt << endl; } return 0; }
#include <iostream> using namespace std; int main(void) { int cnt = 0, n; while (cin >> n) { cnt = 0; for (int a = 0; a <= 9; ++a) for (int b = 0; b <= 9; ++b) for (int c = 0; c <= 9; ++c) for (int d = 0; d <= 9; ++d) if (a + b + c + d == n) ++cnt; cout << cnt << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
108
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { int s = 0; for (int i = 1; i <= 9; i++) for (int j = 1; j <= 9; j++) for (int k = 1; k <= 9; k++) for (int l = 1; l <= 9; l++) if (i + j + k + l == n) s++; cout << s << endl; } }
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { int s = 0; for (int i = 0; i <= 9; i++) for (int j = 0; j <= 9; j++) for (int k = 0; k <= 9; k++) for (int l = 0; l <= 9; l++) if (i + j + k + l == n) s++; cout << s << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 7, 8, 7, 10, 43, 49, 50, 51, 13]]
1
111
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int num = 0; if (n > 36) { cout << "0" << endl; } else { for (int i = 0; i < 10; i++) { if (i > n) { break; } for (int j = 0; j < 10; j++) { if (i + j > n) { break; } for (int k = 0; k < 10; k++) { if (i + j + k > n) { break; } for (int l = 0; l < 10; l++) { if (i + j + k + l > n) { break; } if (i + j + k + l == n) { num++; } } } } } } cout << num << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int num = 0; if (n > 36) { cout << "0" << endl; } else { for (int i = 0; i < 10; i++) { if (i > n) { break; } for (int j = 0; j < 10; j++) { if (i + j > n) { break; } for (int k = 0; k < 10; k++) { if (i + j + k > n) { break; } for (int l = 0; l < 10; l++) { if (i + j + k + l > n) { break; } if (i + j + k + l == n) { num++; } } } } } cout << num << endl; } } return 0; }
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
189
#include <iostream> using namespace std; int main() { int n, a, b, c, d, cnt = 0; while (cin >> n) { cnt = 0; for (a = 0; a < 10 && a < n; a++) { for (b = 0; b < 10 && b < n; b++) { for (c = 0; c < 10 && c < n; c++) { for (d = 0; d < 10 && d < n; d++) { if (a + b + c + d == n) { cnt++; break; } } } } } cout << cnt << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, a, b, c, d, cnt = 0; while (cin >> n) { cnt = 0; for (a = 0; a < 10 && a <= n; a++) { for (b = 0; b < 10 && b <= n; b++) { for (c = 0; c < 10 && c <= n; c++) { for (d = 0; d < 10 && d <= n; d++) { if (a + b + c + d == n) { cnt++; // break; } } } } } cout << cnt << endl; } return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
143
#include <cstdio> using namespace std; int main() { int n; while (scanf(" %d ", &n) == 1) { int c = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { for (int k = 0; k < 9; k++) { for (int l = 0; l < 9; l++) { if (i + j + k + l == n) { c++; } } } } } printf("%d\n", c); } }
#include <cstdio> using namespace std; int main() { int n; while (scanf(" %d ", &n) == 1) { int c = 0; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == n) { c++; } } } } } printf("%d\n", c); } }
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
127
#include <iostream> using namespace std; int main(void) { int n, i = 0; while (cin >> n, !cin.eof()) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (n == a + b + c + d) { i = i + 1; } } } } } } cout << i << endl; return 0; }
#include <iostream> using namespace std; int main(void) { int n, i = 0; while (cin >> n, !cin.eof()) { for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (n == a + b + c + d) { i = i + 1; } } } } } cout << i << endl; i = 0; } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
128
#include <cstdio> int solve(int a, int b) { if (a == 0) { if (0 <= b && b <= 9) return 1; else return 0; } int res = 0; for (int i = 0; i < 10; i++) { res += solve(a - 1, b - i); } return res; } int main() { int a; scanf("%d", &a); printf("%d\n", solve(3, a)); return 0; }
#include <cstdio> int solve(int a, int b) { if (a == 0) { if (0 <= b && b <= 9) return 1; else return 0; } int res = 0; for (int i = 0; i < 10; i++) { res += solve(a - 1, b - i); } return res; } int main() { int a; while (~scanf("%d", &a)) printf("%d\n", solve(3, a)); return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 8, 9, 0, 52, 15, 339, 51, 91, 17, 92], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25]]
1
112
#include <stdio.h> int main() { int in, out, a, b, c, d; while (scanf("%d", in) != EOF) { out = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == in) { out++; } } } } } printf("%d\n", out); } return 0; }
#include <stdio.h> int main() { int in, out, a, b, c, d; while (scanf("%d", &in) != EOF) { out = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == in) { out++; } } } } } printf("%d\n", out); } return 0; }
[["+", 0, 16, 31, 2, 3, 4, 0, 66, 17, 67]]
0
132
int a, i, j; main() { for (; ~scanf("%d", &i);) { for (j = 0, a = 9999; a--;) (a % 10 + a / 10 % 10 + a / 100 % 10 + a / 1000 - i) ? 0 : j++; printf("%d\n", j); } }
int a, i, j; main() { for (; ~scanf("%d", &i);) { for (j = 0, a = 10000; a--;) (a % 10 + a / 10 % 10 + a / 100 % 10 + a / 1000 - i) ? 0 : j++; printf("%d\n", j); } }
[["-", 8, 9, 0, 7, 10, 34, 12, 11, 12, 13], ["+", 8, 9, 0, 7, 10, 34, 12, 11, 12, 13]]
0
83
int a, i, j; main() { for (; ~scanf("%d", &i);) { for (j = 0, a = 9999; a--;) (a % 10 + a / 10 % 10 + a / 100 % 10 + a / 1000 - i) ? 0 : j++; printf("%d\n", j); } }
main(a, i, j) { for (; ~scanf("%d", &i);) { for (j = 0, a = 10000; a--;) (a % 10 + a / 10 % 10 + a / 100 % 10 + a / 1000 - i) ? 0 : j++; printf("%d\n", j); } }
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 0, 30, 0, 1, 0, 2, 63, 22], ["-", 0, 30, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 7, 10, 34, 12, 11, 12, 13], ["+", 8, 9, 0, 7, 10, 34, 12, 11, 12, 13]]
0
83
f(a, b, c) { return c ? f(a - b, 9, c - 1) + (b || f(a, b - 1, c)) : !a; } main(n) { for (; ~scanf("%d", &n); printf("%d\n", f(n, 9, 4))) ; }
f(a, b, c) { return c ? f(a - b, 9, c - 1) + (b ? f(a, b - 1, c) : 0) : !a; } main(n) { for (; ~scanf("%d", &n); printf("%d\n", f(n, 9, 4))) ; }
[["-", 0, 41, 64, 16, 12, 23, 0, 16, 17, 106], ["+", 0, 41, 64, 16, 12, 23, 0, 41, 0, 101], ["+", 0, 41, 64, 16, 12, 23, 0, 41, 0, 102], ["+", 0, 41, 64, 16, 12, 23, 0, 41, 75, 13]]
0
82
#include <stdio.h> int main(int argc, char **argv) { int i, j, k, l, m = 0, n; while (scanf("%d", &n) != EOF) { for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == n) m++; } } } } printf("%d\n", m); } return 0; }
#include <stdio.h> int main(int argc, char **argv) { int i, j, k, l, m, n; while (scanf("%d", &n) != EOF) { m = 0; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == n) m++; } } } } printf("%d\n", m); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
134
#include <stdio.h> int main() { int n; int m; int a, b, c, d; int result; while (scanf("%d", &n) != EOF) { result = 0; if (n > 36) { printf("0\n"); } if (n > 9) { m = 10; } else { m = n + 1; } for (a = 0; a < m; a++) { for (b = 0; b < m; b++) { for (c = 0; c < m; c++) { for (d = 0; d < m; d++) { if (a + b + c + d == n) { result += 1; continue; } } } } } printf("%d\n", result); } return 0; }
#include <stdio.h> int main() { int n; int m; int a, b, c, d; int result; while (scanf("%d", &n) != EOF) { result = 0; if (n > 36) { printf("0\n"); } else { if (n > 9) { m = 10; } else { m = n + 1; } for (a = 0; a < m; a++) { for (b = 0; b < m; b++) { for (c = 0; c < m; c++) { for (d = 0; d < m; d++) { if (a + b + c + d == n) { result += 1; continue; } } } } } printf("%d\n", result); } } return 0; }
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
0
176
#include <stdio.h> int func2(int n) { int count = 0; int a, b, c; /* 4つの数の和では求まらないパターンの排除 */ if (n < 36) { for (a = 0; a < 10; a++) { if (n - a < 0) break; /* この時点までに解が存在しないと分かったとき */ for (b = 0; b < 10; b++) { if (n - (a + b) < 0) break; /* この時点までに解が存在しないと分かったとき */ for (c = 0; c < 10; c++) { /* dの値次第では解が見つかる場合 */ if (n - (a + b + c) < 10 && n - (a + b + c) >= 0) { count++; } } } } } return count; } int main() { int n; while (scanf("%d", &n) != EOF) { printf("%d\n", func2(n)); } return 0; }
#include <stdio.h> int func2(int n) { int count = 0; int a, b, c; /* 4つの数の和では求まらないパターンの排除 */ if (n < 37) { for (a = 0; a < 10; a++) { if (n - a < 0) break; /* この時点までに解が存在しないと分かったとき */ for (b = 0; b < 10; b++) { if (n - (a + b) < 0) break; /* この時点までに解が存在しないと分かったとき */ for (c = 0; c < 10; c++) { /* dの値次第では解が見つかる場合 */ if (n - (a + b + c) < 10 && n - (a + b + c) >= 0) { count++; } } } } } return count; } int main() { int n; while (scanf("%d", &n) != EOF) { printf("%d\n", func2(n)); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
178
#include <stdio.h> int main(void) { int n, a, b, c, d; int count = 0; while (scanf("%d", &n) != EOF) { if (n <= 36) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { count++; } } } } } printf("%d\n", count); } else { printf("0\n"); } } return 0; }
#include <stdio.h> int main(void) { int n, a, b, c, d; int count = 0; while (scanf("%d", &n) != EOF) { if (n <= 36) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if ((a + b + c + d) == n) { count++; } } } } } printf("%d\n", count); count = 0; } else { printf("0\n"); } } return 0; }
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
0
152
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { int a, b, c, d, k = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) k++; } } } } printf("%d", k); } return 0; }
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { int a, b, c, d, k = 0; for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) k++; } } } } printf("%d\n", k); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
127
#include <stdio.h> int main(void) { int n, a, b, c, d, i = 0; while ((scanf("%d", &n)) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) i++; } } } } printf("%d\n", i); } return 0; }
#include <stdio.h> int main(void) { int n, a, b, c, d, i = 0; while ((scanf("%d", &n)) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) i++; } } } } printf("%d\n", i); i = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
130
#include <stdio.h> int main() { int a, b, c, d, n; int count = 0; while (scanf("%d", &n) == 1) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) { count++; } } } } } printf("%d\n", count); } return 0; }
#include <stdio.h> int main() { int a, b, c, d, n; int count = 0; while (scanf("%d", &n) == 1) { for (a = 0; a <= 9; a++) { for (b = 0; b <= 9; b++) { for (c = 0; c <= 9; c++) { for (d = 0; d <= 9; d++) { if (a + b + c + d == n) { count++; } } } } } printf("%d\n", count); count = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
130
#include <stdio.h> int main(void) { int n, h, a, b, c, d; while (scanf("%d", &n) != EOF) { h = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == n) { h++; } } } } } printf("%d", h); } return 0; }
#include <stdio.h> int main(void) { int n, h, a, b, c, d; while (scanf("%d", &n) != EOF) { h = 0; for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == n) { h++; } } } } } printf("%d\n", h); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
133
#include <stdio.h> int main(int argc, const char *argv[]) { int sum; int cnt = 0; int i, j, k, l; while (scanf("%d", &sum) != EOF) { for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == sum) { cnt++; break; } } } } } printf("%d\n", cnt); } return 0; }
#include <stdio.h> int main(int argc, const char *argv[]) { int sum; int cnt = 0; int i, j, k, l; while (scanf("%d", &sum) != EOF) { for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { for (k = 0; k < 10; k++) { for (l = 0; l < 10; l++) { if (i + j + k + l == sum) { cnt++; break; } } } } } printf("%d\n", cnt); cnt = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
142
#include <stdio.h> int main() { int i, j, k, l; int num; int count = 0; int res; while (1) { res = scanf("%d", &num); if (res == EOF) break; if (num < 36) { for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == num) { count++; } } } } } } printf("%d\n", count); count = 0; } return 0; }
#include <stdio.h> int main() { int i, j, k, l; int num; int count = 0; int res; while (1) { res = scanf("%d", &num); if (res == EOF) break; if (num <= 36) { for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == num) { count++; } } } } } } printf("%d\n", count); count = 0; } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
156
#include <stdio.h> int main(void) { int i, j, k, l, o, n = 0; while (scanf("%d", &i) != EOF) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { for (o = 0; o <= 9; o++) { if (i == j + k + l + o) { n++; } } } } } printf("%d\n", n); } return 0; }
#include <stdio.h> int main(void) { int i, j, k, l, o, n = 0; while (scanf("%d", &i) != EOF) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { for (o = 0; o <= 9; o++) { if (i == j + k + l + o) { n++; } } } } } printf("%d\n", n); n = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
130
#include <stdio.h> int main(void) { // your code goes here int z, a, b, c, d, ans = 0; while (scanf("%d", &z) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == z) { ans += 1; } } } } } printf("%d", ans); ans = 0; } return 0; }
#include <stdio.h> int main(void) { // your code goes here int z, a, b, c, d, ans = 0; while (scanf("%d", &z) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if ((a + b + c + d) == z) { ans += 1; } } } } } printf("%d\n", ans); ans = 0; } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
137
#include <stdio.h> int main() { int a, b, c, d, n, m = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { m++; } } } } } printf("%d", m); m = 0; } return 0; }
#include <stdio.h> int main() { int a, b, c, d, n, m = 0; while (scanf("%d", &n) != EOF) { for (a = 0; a < 10; a++) { for (b = 0; b < 10; b++) { for (c = 0; c < 10; c++) { for (d = 0; d < 10; d++) { if (a + b + c + d == n) { m++; } } } } } printf("%d\n", m); m = 0; } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
132
#include <stdio.h> main() { int i, j, k, l, n, cnt = 0; while (1) { if (scanf("%d", &n) == EOF) break; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) cnt++; } } } } printf("%d\n", cnt); } return 0; }
#include <stdio.h> main() { int i, j, k, l, n, cnt = 0; while (1) { if (scanf("%d", &n) == EOF) break; cnt = 0; for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { for (l = 0; l <= 9; l++) { if (i + j + k + l == n) cnt++; } } } } printf("%d\n", cnt); } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
133
#include <stdio.h> main() { int n, h, i, j, k, smp = 0; n <= 50; while (scanf("%d", &n) != EOF) ; for (h = 0; h <= 9; h++) { for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { if (n == h + i + j + k) smp++; } } } } printf("%d\n", smp); return 0; }
#include <stdio.h> main() { int n, h, i, j, k, smp = 0; n <= 50; while (scanf("%d", &n) != EOF) { for (h = 0; h <= 9; h++) { for (i = 0; i <= 9; i++) { for (j = 0; j <= 9; j++) { for (k = 0; k <= 9; k++) { if (n == h + i + j + k) smp++; } } } } printf("%d\n", smp); smp = 0; } return 0; }
[["-", 0, 30, 0, 9, 0, 52, 8, 1, 0, 35], ["+", 0, 30, 0, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 9, 0, 52, 8, 9, 0, 46]]
0
130
#include <stdio.h> main() { int n, a, b, c, d, i = 0; while (scanf("%d", &n) != EOF) { for (a = 9; a >= 0; a--) { for (b = 9; b >= 0; b--) { for (c = 9; c >= 0; c--) { for (d = 9; d >= 0; d--) { if (a + b + c + d == n) { i = i + 1; } } } } } printf("%d", i); i = 0; } return 0; }
#include <stdio.h> main() { int n, a, b, c, d, i = 0; while (scanf("%d", &n) != EOF) { for (a = 9; a >= 0; a--) { for (b = 9; b >= 0; b--) { for (c = 9; c >= 0; c--) { for (d = 9; d >= 0; d--) { if (a + b + c + d == n) { i = i + 1; } } } } } printf("%d\n", i); i = 0; } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
135
#include <iostream> using namespace std; int n; int bfs(int now, int d) { int ans = 0; if (d == 4) { if (now == n) return 1; else return 0; } else { for (int i = 0; i < 10; i++) ans += bfs(now + i, d + 1); } return ans; } int main() { cin >> n; cout << bfs(0, 0) << endl; }
#include <iostream> using namespace std; int n; int bfs(int now, int d) { int ans = 0; if (d == 4) { if (now == n) return 1; else return 0; } else { for (int i = 0; i < 10; i++) ans += bfs(now + i, d + 1); } return ans; } int main() { while (cin >> n) cout << bfs(0, 0) << endl; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25]]
1
100
#include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) sum++; } } } } cout << sum << endl; }
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int sum = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) sum++; } } } } cout << sum << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
109
#include <iostream> using namespace std; int main() { int n, ans = 0; while (cin >> n) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) ans++; } } } } cout << ans << endl; } }
#include <iostream> using namespace std; int main() { int n, ans = 0; while (cin >> n) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { if (i + j + k + l == n) ans++; } } } } cout << ans << endl; ans = 0; } }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
112
#include <algorithm> #include <iomanip> #include <iostream> #include <string> using namespace std; #define pi 3.141592653589793283462 int main() { int c; int d = 0; while (cin >> c) { for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == c) d++; } } } } } cout << d << endl; return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <string> using namespace std; #define pi 3.141592653589793283462 int main() { int c; int d = 0; while (cin >> c) { for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { if (i + j + k + l == c) d++; } } } } cout << d << endl; d = 0; } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
125
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(I, N) for (int I = 0; I < (int)(N); I++) #define FIN(V) cout << V << endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int StrToInt(string); string IntToStr(int); int main(void) { int dp[4][40]; fill_n(*dp, 4 * 40, 0); rep(i, 10) dp[0][i] = 1; for (int i = 1; i <= 3; i++) { for (int j = 36; j >= 0; j--) { for (int k = 0; k <= 9; k++) { if (j - k < 0) break; dp[i][j] += dp[i - 1][j - k]; } } } int n; while (cin >> n) FIN(dp[3][n]); return 0; }
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define rep(I, N) for (int I = 0; I < (int)(N); I++) #define FIN(V) cout << V << endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int StrToInt(string); string IntToStr(int); int main(void) { int dp[4][51]; fill_n(*dp, 4 * 51, 0); rep(i, 10) dp[0][i] = 1; for (int i = 1; i <= 3; i++) { for (int j = 36; j >= 0; j--) { for (int k = 0; k <= 9; k++) { if (j - k < 0) break; dp[i][j] += dp[i - 1][j - k]; } } } int n; while (cin >> n) FIN(dp[3][n]); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
230
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int calc(int i, int count, int sum) { if (count == 0) { if (sum == i) { return 1; } else { return 0; } } else { int count2 = 0; for (int j = 0; j < 10; j++) { count2 += calc(i, count - 1, sum + j); } return count2; } } int main() { int i; cin >> i; cout << calc(i, 4, 0) << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int calc(int i, int count, int sum) { if (count == 0) { if (sum == i) { return 1; } else { return 0; } } else { int count2 = 0; for (int j = 0; j < 10; j++) { count2 += calc(i, count - 1, sum + j); } return count2; } } int main() { int i; while (cin >> i) { cout << calc(i, 4, 0) << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
122
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { int n; cin >> n; while (cin >> n) { int count = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) count++; } } } } cout << count << endl; } return 0; }
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { int n; while (cin >> n) { int count = 0; for (int a = 0; a < 10; a++) { for (int b = 0; b < 10; b++) { for (int c = 0; c < 10; c++) { for (int d = 0; d < 10; d++) { if (a + b + c + d == n) count++; } } } } cout << count << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
126
// Sum of 4 Integers #include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; while (scanf("%d", &n) != EOF) { for (int a = 0; a <= 9; a++) for (int b = 0; b <= 9; b++) for (int c = 0; c <= 9; c++) for (int d = 0; d <= 9; d++) if (a + b + c + d == n) ans++; printf("%d\n", ans); } return 0; }
// Sum of 4 Integers #include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; while (scanf("%d", &n) != EOF) { ans = 0; for (int a = 0; a <= 9; a++) for (int b = 0; b <= 9; b++) for (int c = 0; c <= 9; c++) for (int d = 0; d <= 9; d++) if (a + b + c + d == n) ans++; printf("%d\n", ans); } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
120