結果

問題 No.27 板の準備
ユーザー aimyaimy
提出日時 2017-06-11 15:29:40
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 166,328 KB
実行使用メモリ 5,324 KB
最終ジャッジ日時 2023-10-24 21:04:05
合計ジャッジ時間 3,468 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,216 KB
testcase_01 AC 3 ms
5,216 KB
testcase_02 AC 2 ms
5,224 KB
testcase_03 AC 2 ms
5,216 KB
testcase_04 AC 2 ms
5,220 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
5,224 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
5,220 KB
testcase_14 WA -
testcase_15 AC 2 ms
5,224 KB
testcase_16 AC 2 ms
5,220 KB
testcase_17 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List
import Control.Monad

main = do
 vs <- sort . map read . words <$> getLine
 print (ita vs)

ita vs@[v1,v2,v3,v4] = 
 max 4 $ min ((+3) $ minimum' $ concat [nboards v1 v2 v3, nboards v1 v3 v4, nboards v2 v3 v4]) (2 + div vx gm + div vy gm)
  where
   (gm,(vx,vy)) = maximum [(gcd vx vy, (vx,vy)) | vx <- vs, vy <- (delete vx vs)]
   minimum' xs = if null xs then 0 else minimum xs

nboards x y l = do
 i <- [1 .. div l x]
 j <- [1 .. div (l - i*x) y]
 guard (i*x + j*y == l)
 return (i + j)
0