結果

問題 No.528 10^9と10^9+7と回文
ユーザー 6soukiti296soukiti29
提出日時 2017-06-18 19:07:02
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 949 bytes
コンパイル時間 3,028 ms
コンパイル使用メモリ 68,284 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-12 13:05:29
合計ジャッジ時間 4,703 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 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 1 ms
4,380 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 13) Warning: imported and not used: 'sequtils' [UnusedImport]
/home/judge/data/code/Main.nim(1, 31) Warning: imported and not used: 'unicode' [UnusedImport]

ソースコード

diff #

import math,sequtils,strutils,unicode
proc powInt(n : int64, m : int64, k = 1_000_000_007):int64 =
    if m == 0:
        return 1
    elif m == 1:
        return (n mod k)
    if (m mod 2) == 0:
        return powInt((n*n) mod k,m div 2, k) mod k
    else:
        return (powInt((n*n) mod k,m div 2, k) * n) mod k
proc CToI(c : char):int =
    return( int(c) - int('0'))
var
    mod_Bill = 1_000_000_000
    mod_Bill_7 = 1_000_000_007
    N : string
    p : int64
let N1 = stdin.readline
proc kaibun(N : string):int64 =
    var x = N.len
    var
        X : seq[int64]
        i = 2
        a : int64
    a = parseBiggestInt(N[0..<((x + 1) div 2)])
    a += powInt(10, x div 2) - 2
    for i in 0..<x div 2:
        if N[i] > N[^(i + 1)]:
            break
        if i == (x div 2) - 1 or ((x div 2) == 1 and i == (x div 2) - 1):
            a += 1
    if x == 1:
        a+=1
    return a
p = kaibun(N1)
echo p mod mod_Bill
echo p mod mod_Bill_7
0