結果
問題 |
No.528 10^9と10^9+7と回文
|
ユーザー |
![]() |
提出日時 | 2017-06-18 19:17:33 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,031 bytes |
コンパイル時間 | 3,043 ms |
コンパイル使用メモリ | 65,024 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 01:26:29 |
合計ジャッジ時間 | 3,894 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 3 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].CToI == N[^(i + 1)].CToI: discard elif N[i].CToI > N[^(i + 1)].CToI: a += 1 break else: break if 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