結果
問題 | No.1156 Nada Picnic 2 |
ユーザー | kpinkcat |
提出日時 | 2023-08-27 19:42:26 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,099 bytes |
コンパイル時間 | 1,058 ms |
コンパイル使用メモリ | 112,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-08 15:26:42 |
合計ジャッジ時間 | 2,934 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 873 ms
5,376 KB |
testcase_02 | WA | - |
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> #include<string> using namespace std; int main() { int a, b, c, d, e, f, g, h, i, j, n; cin >> n; set<int> st; if (n == 1){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ for (int c = 0; c <= 9; c++){ for (int d = 1; d <= 9; d++){ for (int e = 0; e <= 9; e++){ for (int f = 0; f <= 9; f++){ if((100*a + 10 + c) + (100*d + 10*e + f) == 1000 + 100*b + 10*c + 1){ st.insert(a); st.insert(b); st.insert(c); st.insert(d); st.insert(e); st.insert(f); st.insert(1); if (st.size() == 7) cout << 1 << b << c << 1 << endl; st.clear(); } } } } } } } } if (n == 2){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ for (int c = 0; c <= 9; c++){ for (int d = 1; d <= 9; d++){ for (int e = 0; e <= 9; e++){ for (int f = 0; f <= 9; f++){ for (int g = 0; g <= 9; g++){ for (int h = 0; h <= 9; h++){ for (int i = 0; i <= 9; i++){ if((1000*a + 100*a + 10*b + c) + (1000*d + 100*e + 10*f + g) == 10000 + 1000*h + 100*b + 10*c + i){ st.insert(a); st.insert(b); st.insert(c); st.insert(d); st.insert(e); st.insert(f); st.insert(g); st.insert(h); st.insert(i); st.insert(1); if (st.size() == 10) cout << 1 << h << b << c << i << endl; st.clear(); } } } } } } } } } } } if (n == 3){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ if (b == a) continue; for (int c = 0; c <= 9; c++){ if (c == a || c == b) continue; for (int d = 0; d <= 9; d++){ if (d == a || d == b || d == c) continue; for (int e = 0; e <= 9; e++){ if (e == a || e == b || e == c || e == d) continue; for (int f = 0; f <= 9; f++){ if (f == a || f == b || f == c || f == d || f == e) continue; for (int g = 1; g <= 9; g++){ if (g == a || g == b || g == c || g == d || g == e || g == f) continue; for (int h = 0; h <= 9; h++){ if (h == a || h == b || h == c || h == d || h == e || h == f || h == g) continue; for (int i = 0; i <= 9; i++){ if (i == a || i == b || i == c || i == d || i == e || i == f || i == g || i == h) continue; for (int j = 0; j <= 9; j++){ if (j == a || j == b || j == c || j == d || j == e || j == f || j == g || j == h || j == i) continue; if((100000*a + 10000*b + 1000*c + 100*d + 10*e + f) + (10000*g + 1000*d + 100*f + 10*g + i) == 100000*(a+1) + 10000*d + 1000*j + 100*e + 10*d + j){ cout << a+1 << d << j << e << d << j << endl; } } } } } } } } } } } } }