結果
| 問題 | No.128 お年玉(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-07 22:40:06 |
| 言語 | Haskell (9.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 295 bytes |
| 記録 | |
| コンパイル時間 | 1,100 ms |
| コンパイル使用メモリ | 196,096 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-17 12:03:27 |
| 合計ジャッジ時間 | 2,103 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 15 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:11:21: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in GHC.Internal.List):
"This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
|
11 | digitToInt (head $ show v) * (10^dil v)
| ^^^^
[2 of 2] Linking a.out
ソースコード
import Data.Char (digitToInt)
import Control.Monad (replicateM)
dil :: Show a => a -> Int
dil = pred . length . show
main :: IO ()
main = do
[n, m] <- map read <$> replicateM 2 getLine
print $ let v = n `div` m in if v < 1000 then 0 else
digitToInt (head $ show v) * (10^dil v)