結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2017-01-12 23:54:28 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 5,352 ms |
コンパイル使用メモリ | 176,188 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 10:16:27 |
合計ジャッジ時間 | 5,867 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
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 Control.Monad import Control.Applicative solve :: Integral a => a -> a -> a -> a -> a solve n a b c = t1 - t2 + t3 where t1 = (n `div` a) + (n `div` b) + (n `div` c) t2 = (n `div` (lcm a b)) + (n `div` (lcm b c)) + (n `div` (lcm c a)) t3 = (n `div` (lcm (lcm a b) c)) main = do n <- readLn [a, b, c] <- map read . words <$> getLine putStrLn $ show $ solve n a b c