結果
| 問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
| ユーザー |
chacoder1
|
| 提出日時 | 2021-01-31 16:53:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 868 bytes |
| コンパイル時間 | 1,978 ms |
| コンパイル使用メモリ | 193,112 KB |
| 最終ジャッジ日時 | 2025-01-18 10:18:03 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
int main(){
string a,b;
cin>>a>>b;
int flag=1;
int lena=a.length();
int lenb=b.length();
if(a.at(0)=='0' && lena>1){
cout<<"NG"<<endl;
return 0;
}
if(b.at(0)=='0' && lenb>1){
cout<<"NG"<<endl;
return 0;
}
int x=0;
for(int i=0;i<lena;i++){
if(a.at(i)>'9' || a.at(i)<'0'){
cout<<"NG"<<endl;
return 0;
}
x+=(a.at(i)-'0');
if(i != lena-1){
x*=10;
}
}
if(x>12345){
cout<<"NG"<<endl;
return 0;
}
x=0;
for(int i=0;i<lenb;i++){
if(b.at(i)>'9' || b.at(i)<'0'){
cout<<"NG"<<endl;
return 0;
}
x+=(b.at(i)-'0');
if(i != lenb-1){
x*=10;
}
}
if(x>12345){
cout<<"NG"<<endl;
return 0;
}
cout<<"OK"<<endl;
return 0;
}
chacoder1