結果

問題 No.796 well known
ユーザー 情報学生情報学生
提出日時 2019-08-30 11:31:17
言語 Haskell
(9.8.2)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 4,644 ms
コンパイル使用メモリ 178,384 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-04-30 21:40:31
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 14 ms
10,880 KB
testcase_05 AC 14 ms
11,008 KB
testcase_06 AC 17 ms
11,904 KB
testcase_07 AC 6 ms
8,064 KB
testcase_08 AC 15 ms
11,008 KB
testcase_09 AC 10 ms
9,856 KB
testcase_10 AC 17 ms
11,776 KB
testcase_11 AC 4 ms
7,040 KB
testcase_12 AC 9 ms
9,216 KB
testcase_13 AC 13 ms
10,752 KB
testcase_14 AC 7 ms
8,576 KB
testcase_15 AC 10 ms
9,472 KB
testcase_16 AC 17 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

main :: IO ()
main = do
    n <- readLn
    putStrLn $ unwords $ map show $ solve n

solve :: Int -> [Int]
solve n | n `mod` 3 == 0 = reverse $ 3 : 3 : replicate (n - 2) 1
        | n `mod` 3 == 1 = reverse $ 3 : 3 : 3 : replicate (n - 3) 1
        | otherwise      = reverse $ 3 : replicate (n - 1) 1
0