結果

問題 No.791 うし数列
ユーザー ei1333333
提出日時 2018-10-28 01:20:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-11-19 06:56:39
合計ジャッジ時間 970 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
if N == 1 or N == 3:
    print -1
else:
    ret = 0
    while N > 1:
        N -= 3
        if N % 10 != 0:
            print -1
            break
        N /= 10
        ret += 1
    if N == 1 and ret > 0:
        print ret
0