結果

問題 No.796 well known
ユーザー きつねうどんきつねうどん
提出日時 2023-12-16 01:12:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 3,151 ms
コンパイル使用メモリ 74,972 KB
実行使用メモリ 67,092 KB
最終ジャッジ日時 2023-12-16 01:12:40
合計ジャッジ時間 8,121 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
57,832 KB
testcase_01 AC 97 ms
55,692 KB
testcase_02 AC 98 ms
56,704 KB
testcase_03 AC 124 ms
57,556 KB
testcase_04 AC 276 ms
66,936 KB
testcase_05 AC 295 ms
66,972 KB
testcase_06 AC 355 ms
67,084 KB
testcase_07 AC 221 ms
60,520 KB
testcase_08 AC 292 ms
67,064 KB
testcase_09 AC 260 ms
64,660 KB
testcase_10 AC 321 ms
66,992 KB
testcase_11 AC 188 ms
57,328 KB
testcase_12 AC 234 ms
62,140 KB
testcase_13 AC 281 ms
66,976 KB
testcase_14 AC 236 ms
61,912 KB
testcase_15 AC 262 ms
63,408 KB
testcase_16 AC 321 ms
67,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class WellKnown {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int div = N / 3;
        int remain = N % 3;
        if (remain == 2) {
            System.out.print("1 3");
        } else if (remain == 1) {
            System.out.print("1 1 2 3");
            div = div - 1;
        } else {
            System.out.print("3 3 1");
            div = div - 1;
        }

        for (int i = 0; i < div; i++) {
            System.out.print(" 1 1 1");
        }
    }
}
0