結果
問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
ユーザー |
![]() |
提出日時 | 2016-12-27 22:36:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,058 bytes |
コンパイル時間 | 1,142 ms |
コンパイル使用メモリ | 94,620 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 04:52:31 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 6 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <set> #include <queue> #include <algorithm> #include <string> #include <cmath> #include <functional> #include <iomanip> #include <map> #define _USE_MATH_DEFINES #include <math.h> using namespace std; #define MAX 100000 char ic[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; int main() { string a, b; bool f = true; bool zero = true; cin >> a >> b; for (int i = 0; i < a.length(); ++i) { if (find(ic, ic + 10, a[i]) == end(ic)) { f = false; break; } else { if (zero) { if (i != a.length() - 1 && a[i] == '0') { f = false; break; } else { zero = false; } } } } zero = true; for (int i = 0; i < b.length() && f; ++i) { if (find(ic, ic + 10, b[i]) == end(ic)) { f = false; break; } else { if (zero) { if (i != b.length() - 1 && b[i] == '0') { f = false; break; } else { zero = false; } } } } if (f) { cout << stoi(a) + stoi(b) << endl; } else { cout << "NG" << endl; } return 0; }