結果
問題 |
No.2784 繰り上がりなし十進和
|
ユーザー |
|
提出日時 | 2024-06-14 22:10:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 892 bytes |
コンパイル時間 | 2,442 ms |
コンパイル使用メモリ | 206,412 KB |
最終ジャッジ日時 | 2025-02-21 22:04:10 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 30 RE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); set<int> S; for(int i=0; i<6; i++){ string s; cin >> s; int x = stoi(s); S.insert(x); } vector<bool> already(1000000); already.at(0) = true; queue<int> Q; Q.push(0); int answer = 0; while(Q.size()){ int pos = Q.front(); Q.pop(); answer++; for(auto s : S){ int x = pos,y = s; string st = ""; for(int k=0; k<6; k++){ int a = x%10+y%10; a %= 10; st += '0'+a; x /= 10,y /= 10; } reverse(st.begin(),st.end()); int next = stoi(st); if(!already.at(next)) already.at(next) = true,Q.push(pos+s); } } cout << answer << endl; }