結果
| 問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
| コンテスト | |
| ユーザー |
gigime
|
| 提出日時 | 2016-11-18 22:32:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 892 bytes |
| コンパイル時間 | 1,565 ms |
| コンパイル使用メモリ | 159,780 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-26 07:13:38 |
| 合計ジャッジ時間 | 1,928 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;
int N,M;
string A,B;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> A >> B;
N = A.size(); M = B.size();
bool ok = true;
FOR(i,0,N){
if(A [i] < '0' || '9' < A [i]){
ok = false;
}
}
FOR(i,0,M){
if(B [i] < '0' || '9' < B [i]){
ok = false;
}
}
if(A.front() == '0' && N != 1){
ok = false;
}
if(B.front() == '0' && M != 1){
ok = false;
}
if(ok && (stoi(A) < 0 || stoi(A) > 12345)){
ok = false;
}
if(ok && (stoi(B) < 0 || stoi(B) > 12345)){
ok = false;
}
cout << (ok ? "OK" : "NG") << endl;
return 0;
}
gigime