Yukicoder No.446 ゆきこーだーの雨と雪 (1)

,

http://yukicoder.me/problems/no/446

implementation

python 愚直

#!/usr/bin/env python3
a = input()
b = input()
try:
    assert a == str(int(a)) and 0 <= int(a) <= 12345
    assert b == str(int(b)) and 0 <= int(b) <= 12345
    result = 'OK'
except:
    result = 'NG'
print(result)

perl $48$byte

/^0.|[^0-9
]/||$_>12345?$a=NG:0for<>;print$a||OK

反省

以下はtailsさんの$39$byte perl解(http://yukicoder.me/submissions/131308)。

print grep(/^0.|\pL/|$_>12345,<>)?NG:OK

大敗したのでちゃんと書く: