結果
問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
ユーザー |
![]() |
提出日時 | 2020-06-13 20:34:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 1,632 ms |
コンパイル使用メモリ | 166,344 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 20:23:57 |
合計ジャッジ時間 | 2,473 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool is_number(char c) { return c >= '0' && c <= '9'; } int main() { string s, t; cin >> s >> t; int n = s.size(); int m = t.size(); if ((n > 1 && s[0] == '0') || (m > 1 && t[0] == '0')) { puts("NG"); return 0; } for (int i = 0; i < n; ++i) { if (!is_number(s[i])) { puts("NG"); return 0; } } for (int i = 0; i < m; ++i) { if (!is_number(t[i])) { puts("NG"); return 0; } } int x = stoi(s); int y = stoi(t); if (x <= 12345 && y <= 12345) { puts("OK"); } else { puts("NG"); } return 0; }