結果

問題 No.522 Make Test Cases(テストケースを作る)
ユーザー kou_kkk
提出日時 2025-07-06 02:29:25
言語 Haskell
(9.10.1)
結果
OLE  
実行時間 -
コード長 537 bytes
コンパイル時間 8,817 ms
コンパイル使用メモリ 175,104 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2025-07-06 02:29:42
合計ジャッジ時間 16,465 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 OLE * 1 -- * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

module Main where

main :: IO ()
main = readLn >>= mapM_ putStrLn . solve

solve :: Int -> [String]
solve = map (unwords . map show) . aux 1 1 . (subtract 2)

aux :: Int -> Int -> Int -> [[Int]]
aux a b c | c - a == 1 = [ns]
          | otherwise  = ns : aux a' b' c'
          where
          ns = [a, b, c]
          (a', b', c') = next a b c

next :: Int -> Int -> Int -> (Int, Int, Int)
next a b c | b + 1 <= c - 1 = (a, b + 1, c - 1)
           | otherwise = (a + 1, a + 1, n - (a + 1) * 2)
           where
           n = a + b + c
0