結果
問題 | No.1458 Segment Function |
ユーザー |
|
提出日時 | 2021-03-31 21:42:49 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,120 KB |
実行使用メモリ | 76,684 KB |
最終ジャッジ日時 | 2024-10-12 13:35:23 |
合計ジャッジ時間 | 3,718 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 RE * 13 |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") p,n = input().split() n = int(n) l = [6,2,5,5,4,5,6,4,7,6] if n==0: write(p) else: n -= 1 if p[0]=="-": v = sum((l[v] for v in map(int, p[1:]))) + 1 else: v = sum((l[v] for v in map(int, p))) res = [] for _ in range(10000): res.append(v) v = sum((l[int(vv)] for vv in str(v))) if n>=len(res): print(res[-1]) else: print(res[n])