結果
| 問題 |
No.528 10^9と10^9+7と回文
|
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-06-18 19:07:02 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 949 bytes |
| コンパイル時間 | 3,026 ms |
| コンパイル使用メモリ | 65,528 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 01:25:49 |
| 合計ジャッジ時間 | 4,165 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 1 RE * 17 |
コンパイルメッセージ
/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]
ソースコード
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
6soukiti29