結果

問題 No.478 一般門松列列
ユーザー YamaKasaYamaKasa
提出日時 2018-09-23 14:11:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 365 ms / 2,000 ms
コード長 865 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 76,068 KB
実行使用メモリ 65,332 KB
最終ジャッジ日時 2023-10-11 22:52:17
合計ジャッジ時間 13,797 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
55,968 KB
testcase_01 AC 143 ms
56,084 KB
testcase_02 AC 144 ms
55,804 KB
testcase_03 AC 141 ms
55,548 KB
testcase_04 AC 143 ms
55,872 KB
testcase_05 AC 143 ms
56,264 KB
testcase_06 AC 143 ms
56,152 KB
testcase_07 AC 144 ms
56,008 KB
testcase_08 AC 143 ms
55,784 KB
testcase_09 AC 142 ms
56,144 KB
testcase_10 AC 141 ms
55,908 KB
testcase_11 AC 365 ms
64,984 KB
testcase_12 AC 360 ms
64,872 KB
testcase_13 AC 355 ms
65,332 KB
testcase_14 AC 357 ms
65,324 KB
testcase_15 AC 347 ms
64,776 KB
testcase_16 AC 281 ms
61,232 KB
testcase_17 AC 358 ms
64,608 KB
testcase_18 AC 316 ms
64,792 KB
testcase_19 AC 357 ms
65,072 KB
testcase_20 AC 337 ms
64,952 KB
testcase_21 AC 324 ms
65,060 KB
testcase_22 AC 290 ms
63,072 KB
testcase_23 AC 290 ms
61,708 KB
testcase_24 AC 314 ms
64,988 KB
testcase_25 AC 341 ms
64,932 KB
testcase_26 AC 203 ms
56,548 KB
testcase_27 AC 204 ms
55,912 KB
testcase_28 AC 199 ms
56,600 KB
testcase_29 AC 205 ms
56,176 KB
testcase_30 AC 302 ms
65,236 KB
testcase_31 AC 291 ms
62,728 KB
testcase_32 AC 272 ms
60,964 KB
testcase_33 AC 280 ms
60,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		scan.close();
		int t = n - k;
		if(t == 0) {
			for(int i = 0; i < n; i++) {
				if(i == n - 1) {
					System.out.println(1);
				}else {
					System.out.print(1 + " ");
				}
			}
		}else {
			int[]kado = {2, 3, 1, 4};
			if(k == 0) {
				for(int i = 0; i < n; i++) {
					if(i == n - 1) {
						System.out.println(kado[i % 4]);
					}else {
						System.out.print(kado[i % 4] + " ");
					}
				}
			}else {
				for(int i = 0; i < t; i++) {
					System.out.print(kado[i % 4] + " ");
				}
				for(int i = t; i < n; i++) {
					if(i == n - 1) {
						System.out.println(kado[(t - 1) % 4]);
					}else {
						System.out.print(kado[(t - 1) % 4] + " ");
					}
				}
			}

		}
	}
}
0