結果

問題 No.1458 Segment Function
ユーザー hir355
提出日時 2021-03-31 23:11:17
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 333 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 67,712 KB
最終ジャッジ日時 2024-11-07 09:06:38
合計ジャッジ時間 4,049 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 RE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

a = [6, 2, 5, 5, 4, 5, 6, 4, 7, 6]
p, n = map(int, input().split())
if n == 0:
    print(p)
    exit(0)
if p < 0:
    n -= 1
    res = 0
    for c in str(-p):
        res += a[ord(c) - ord('0')]
    p = res + 1
for i in range(min(n, 10000)):
    res = 0
    for c in str(p):
        res += a[ord(c) - ord('0')]
    p = res
print(res)
0