結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-11-11 18:15:43 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 492 ms / 2,000 ms | 
| コード長 | 345 bytes | 
| コンパイル時間 | 1,761 ms | 
| コンパイル使用メモリ | 171,648 KB | 
| 実行使用メモリ | 111,232 KB | 
| 最終ジャッジ日時 | 2024-11-24 19:22:20 | 
| 合計ジャッジ時間 | 12,282 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
コンパイルメッセージ
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
ソースコード
import Data.Char (digitToInt)
import Data.List
main = do
  n <- getLine
  case (remainder n 3, remainder n 5) of
    (0, 0) -> putStrLn "FizzBuzz"
    (0, _) -> putStrLn "Fizz"
    (_, 0) -> putStrLn "Buzz"
    (_, _) -> putStrLn n
remainder :: String -> Int -> Int
remainder n m = foldl' (\ans x -> (ans*4 + x) `mod` m) 0 $ map digitToInt n
            
            
            
        