結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー |
![]() |
提出日時 | 2017-02-27 21:47:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 487 ms |
コンパイル使用メモリ | 68,276 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-11 19:53:42 |
合計ジャッジ時間 | 1,128 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
#include <iostream>#include <math.h>using namespace std;bool check(string S){int num = 0;try{num = stoi(S);}catch(const std::invalid_argument& e){return false;}if(num>12345){return false;}num = (int)log10((double)num) + 1;//cout << "num : " << num << "\n";//cout << "s.size() : " << S.size() << "\n";if(num > 0 && S.size() > num){return false;}else if(0 > num && S.size() > 1){return false;}return true;}int main(void){int i;string A,B;cin >> A >> B;if(check(A) == 1 && check(B) == 1){cout << "OK\n";}else{cout << "NG\n";}return 0;}