結果

問題 No.446 ゆきこーだーの雨と雪 (1)
コンテスト
ユーザー kichirb3
提出日時 2018-03-03 16:48:32
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 769 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 379 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-03-19 22:42:55
合計ジャッジ時間 2,683 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-
"""
No.446 ゆきこーだーの雨と雪 (1)
https://yukicoder.me/problems/no/446

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B):
    try:
        num_a = int(A)
        num_b = int(B)
    except:
        return 'NG'

    if not 0 <= num_a <= 12345:
        return 'NG'
    if not 0 <= num_b <= 12345:
        return 'NG'
    if num_a == 0 and len(A) > 1:
        return 'NG'
    if num_b == 0 and len(B) > 1:
        return 'NG'
    if A[0] == '0' and num_a != 0:
        return 'NG'
    if B[0] == '0' and num_b != 0:
        return 'NG'

    return 'OK'


def main(args):
    A = input().strip()
    B = input().strip()
    ans = solve(A, B)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0