結果
| 問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
| ユーザー |
not_522
|
| 提出日時 | 2016-11-22 01:33:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,068 bytes |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 167,052 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 09:34:43 |
| 合計ジャッジ時間 | 1,999 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct Initializer {
Initializer() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(15);
}
} initializer;
template<typename T = long long> inline T toInteger(const string&);
template<> inline int toInteger<int>(const string& s) {
return stoi(s);
}
template<> inline long toInteger<long>(const string& s) {
return stol(s);
}
template<> inline long long toInteger<long long>(const string& s) {
return stoll(s);
}
template<typename T = long long> inline T toInteger(const string& s, int n) {
T res = 0;
for (char c : s) {
if (isdigit(c)) res = res * n + c - '0';
else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10;
}
return s[0] == '-' ? -res : res;
}
bool is_valid(string s) {
for (char c : s) if (!isdigit(c)) return false;
if (s.size() != 1u && s[0] == '0') return false;
int n = toInteger<int>(s);
return 0 <= n && n <= 12345;
}
int main() {
string a, b;
cin >> a >> b;
cout << (is_valid(a) && is_valid(b) ? "OK" : "NG") << endl;
}
not_522