結果
問題 | No.16 累乗の加算 |
ユーザー |
|
提出日時 | 2016-03-07 04:05:40 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 354 bytes |
コンパイル時間 | 6,134 ms |
コンパイル使用メモリ | 170,240 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2024-06-26 05:10:03 |
合計ジャッジ時間 | 2,667 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
d = 1000003decbin 0 = [0]decbin 1 = [1]decbin n = (n`mod`2):(decbin (n`div`2))f x n = product(map(g x)(zipWith(*)(decbin n)[1..]))`mod`dg x 0 = 1g x 1 = xg x n = ((g x (n-1))^2)`mod`dmain=do[x,_]<-getLine>>=return.map(read::String->Integer).wordsa<-getLine>>=return.map(read::String->Integer).wordsprint$(sum[f x n|n<-a])`mod`d