結果

問題 No.46 はじめのn歩
ユーザー mtwtkmanmtwtkman
提出日時 2023-05-13 19:20:34
言語 Haskell
(9.8.2)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 11,263 ms
コンパイル使用メモリ 164,368 KB
実行使用メモリ 7,216 KB
最終ジャッジ日時 2023-08-19 16:54:39
合計ジャッジ時間 10,862 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,016 KB
testcase_01 AC 2 ms
6,956 KB
testcase_02 AC 2 ms
6,976 KB
testcase_03 AC 2 ms
7,108 KB
testcase_04 AC 2 ms
7,104 KB
testcase_05 AC 2 ms
7,124 KB
testcase_06 AC 2 ms
7,104 KB
testcase_07 AC 2 ms
7,096 KB
testcase_08 AC 2 ms
7,216 KB
testcase_09 AC 3 ms
7,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

split :: String -> [String]
split = go ("", [])
  where
    go :: (String, [String]) -> String -> [String]
    go (a, acc) "" = acc <> [a]
    go (a, acc) (' ' : xs) = go ("", acc <> [a]) xs
    go (a, acc) (x : xs) = go (a <> [x], acc) xs

prompt :: IO [String]
prompt = do split <$> getLine

tupleInput :: [String] -> (Int, Int)
tupleInput xs = (read $ head xs, read $ last xs)

main :: IO ()
main = do
  vs <- prompt
  let (a,b) = tupleInput vs
      (n,r) = b `quotRem` a
  print $ n + max (min r 1) 0
0