結果

問題 No.478 一般門松列列
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-04 01:41:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 3,173 ms
コンパイル使用メモリ 72,884 KB
実行使用メモリ 56,420 KB
最終ジャッジ日時 2023-09-13 17:23:55
合計ジャッジ時間 10,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,900 KB
testcase_01 AC 120 ms
55,728 KB
testcase_02 AC 121 ms
55,604 KB
testcase_03 AC 124 ms
55,712 KB
testcase_04 AC 121 ms
56,196 KB
testcase_05 AC 126 ms
55,500 KB
testcase_06 AC 123 ms
56,192 KB
testcase_07 AC 120 ms
55,852 KB
testcase_08 AC 125 ms
55,884 KB
testcase_09 AC 120 ms
55,748 KB
testcase_10 AC 122 ms
55,448 KB
testcase_11 AC 158 ms
56,420 KB
testcase_12 AC 151 ms
53,484 KB
testcase_13 AC 163 ms
54,012 KB
testcase_14 AC 160 ms
56,068 KB
testcase_15 AC 163 ms
55,860 KB
testcase_16 AC 148 ms
56,128 KB
testcase_17 AC 153 ms
55,636 KB
testcase_18 AC 154 ms
55,984 KB
testcase_19 AC 164 ms
55,656 KB
testcase_20 AC 152 ms
55,996 KB
testcase_21 AC 159 ms
56,164 KB
testcase_22 AC 148 ms
55,652 KB
testcase_23 AC 157 ms
55,844 KB
testcase_24 AC 156 ms
55,464 KB
testcase_25 AC 157 ms
55,808 KB
testcase_26 AC 131 ms
55,944 KB
testcase_27 AC 124 ms
55,908 KB
testcase_28 AC 122 ms
55,772 KB
testcase_29 AC 122 ms
56,216 KB
testcase_30 AC 151 ms
55,708 KB
testcase_31 AC 150 ms
55,972 KB
testcase_32 AC 137 ms
55,856 KB
testcase_33 AC 150 ms
56,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No478{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();

		StringBuilder sb = new StringBuilder();
		int v = 2;
		boolean down = true;
		for(int i = 0; i < n; i++){
			if(i <= k){
				sb.append(0);
				sb.append(" ");
			}
			else{
				if(down){
					sb.append(v--);
					sb.append(" ");
					down = false;
				}else{
					sb.append(v);
					sb.append(" ");
					v += 2;
					down = true;
				}
			}
		}
		System.out.println(sb);
	}
}
0