結果

問題 No.528 10^9と10^9+7と回文
ユーザー convexineqconvexineq
提出日時 2021-02-24 02:46:47
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 323 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 65,940 KB
最終ジャッジ日時 2023-10-24 04:59:43
合計ジャッジ時間 2,568 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,508 KB
testcase_01 AC 38 ms
53,508 KB
testcase_02 AC 38 ms
53,508 KB
testcase_03 AC 36 ms
53,508 KB
testcase_04 AC 36 ms
53,508 KB
testcase_05 AC 38 ms
53,508 KB
testcase_06 AC 37 ms
53,508 KB
testcase_07 AC 37 ms
53,508 KB
testcase_08 AC 36 ms
53,508 KB
testcase_09 AC 36 ms
53,508 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 37 ms
53,508 KB
testcase_23 AC 36 ms
53,508 KB
testcase_24 AC 41 ms
59,308 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def kaibun_number(s,MOD):
    m = (len(s)+1)//2
    ans = int(s[:m])%MOD - pow(10,m-1,MOD) + 1
    if s[m-len(s)%2:] < s[:m][::-1]: ans -= 1
    r = 9
    for i in range(1,len(s)):
        ans += r
        if i%2==0: r = r*10%MOD
    return ans%MOD

s = input()
print(kaibun_number(s,10**9))
print(kaibun_number(s,10**9+7))
0