結果
問題 | No.2784 繰り上がりなし十進和 |
ユーザー |
|
提出日時 | 2024-06-14 22:07:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 886 bytes |
コンパイル時間 | 2,223 ms |
コンパイル使用メモリ | 206,532 KB |
最終ジャッジ日時 | 2025-02-21 22:02:50 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 31 |
ソースコード
#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;if(x+s >= 1000000) continue;if(already.at(x+s)) continue;bool ok = true;for(int k=0; k<6; k++){int a = x%10,b = y%10;if(a+b >= 10){ok = false; break;}x /= 10,y /= 10;}if(ok) already.at(pos+s) = true,Q.push(pos+s);}}cout << answer << endl;}