結果

問題 No.528 10^9と10^9+7と回文
ユーザー mkawa2mkawa2
提出日時 2021-11-12 10:32:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,268 bytes
コンパイル時間 2,552 ms
コンパイル使用メモリ 86,600 KB
実行使用メモリ 95,600 KB
最終ジャッジ日時 2023-08-16 07:20:07
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,172 KB
testcase_01 AC 69 ms
71,320 KB
testcase_02 AC 70 ms
71,356 KB
testcase_03 AC 69 ms
71,320 KB
testcase_04 AC 68 ms
71,124 KB
testcase_05 AC 70 ms
71,288 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 70 ms
71,164 KB
testcase_09 AC 70 ms
71,280 KB
testcase_10 AC 114 ms
95,512 KB
testcase_11 AC 111 ms
95,536 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 93 ms
79,216 KB
testcase_20 AC 106 ms
88,816 KB
testcase_21 WA -
testcase_22 AC 72 ms
71,368 KB
testcase_23 AC 72 ms
71,224 KB
testcase_24 AC 77 ms
76,144 KB
testcase_25 AC 86 ms
76,528 KB
testcase_26 AC 111 ms
95,440 KB
testcase_27 AC 108 ms
95,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0