結果
問題 | No.528 10^9と10^9+7と回文 |
ユーザー | mkawa2 |
提出日時 | 2021-11-12 10:32:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,268 bytes |
コンパイル時間 | 222 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 91,104 KB |
最終ジャッジ日時 | 2024-05-03 16:21:47 |
合計ジャッジ時間 | 3,076 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
52,224 KB |
testcase_01 | AC | 37 ms
52,096 KB |
testcase_02 | AC | 37 ms
51,968 KB |
testcase_03 | AC | 38 ms
52,352 KB |
testcase_04 | AC | 38 ms
52,224 KB |
testcase_05 | AC | 38 ms
52,352 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 42 ms
52,480 KB |
testcase_09 | AC | 37 ms
52,352 KB |
testcase_10 | AC | 90 ms
89,472 KB |
testcase_11 | AC | 82 ms
89,472 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 61 ms
70,144 KB |
testcase_20 | AC | 75 ms
81,792 KB |
testcase_21 | WA | - |
testcase_22 | AC | 38 ms
51,840 KB |
testcase_23 | AC | 39 ms
52,096 KB |
testcase_24 | AC | 45 ms
59,776 KB |
testcase_25 | AC | 54 ms
66,176 KB |
testcase_26 | AC | 81 ms
89,088 KB |
testcase_27 | AC | 76 ms
88,064 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = 18446744073709551615 inf = 4294967295 md = 10**9+7 # md = 998244353 md1 = 10**9 s = list(map(int, SI())) n = len(s) if n == 1: print(s[0]) print(s[0]) exit() for i in range(n//2): if s[i] < s[n-1-i]: s.reverse() break s = s[n//2:] # print(s) s[-1] -= 1 s[0] += 1 m = md for m in [md1, md]: cc = [0] for k in range(1, n): if k == 1: c = 9 elif k & 1: c = cc[k-1]*10%m else: c = cc[k-1] cc.append(c) ans = 0 for c in cc: ans = (ans+c)%m # print(ans, cc) if s[-1] != -1: ten = 1 for a in s: ans += a*ten ans %= m ten = ten*10%m print(ans)