結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
shikatsusan
|
| 提出日時 | 2016-05-16 02:55:59 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 486 bytes |
| コンパイル時間 | 2,183 ms |
| コンパイル使用メモリ | 172,416 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 05:15:04 |
| 合計ジャッジ時間 | 2,929 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 )
Main.hs:14:18: warning: [GHC-47082] [-Woperator-whitespace-ext-conflict]
The prefix use of a ‘$’ would denote an untyped splice
were the TemplateHaskell extension enabled.
Suggested fix: Add whitespace after the ‘$’.
|
14 | ) $xsi
| ^
[2 of 2] Linking a.out
ソースコード
main::IO()
main =do
xi:_:[] <- fmap (fmap read . words) getLine
xsi <- fmap (fmap read . words) getLine
let moda =1000003
hyou 0 _ = []
hyou n g = cal:hyou (n-1) cal
where cal = (g * g) `mod` moda
xtenkai 0 = []
xtenkai x = (x `mod` 2 ==1):xtenkai (x `div` 2)
print . (`mod` moda) . sum . map (\x->
foldl (\acc (a,b) ->if b then acc*a else acc) 1 .
zip (xi:hyou 31 xi) $ xtenkai x
) $xsi
shikatsusan