結果

問題 No.478 一般門松列列
ユーザー htensaihtensai
提出日時 2019-11-19 08:51:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 2,461 ms
コンパイル使用メモリ 75,284 KB
実行使用メモリ 54,480 KB
最終ジャッジ日時 2024-04-14 09:20:52
合計ジャッジ時間 9,192 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,256 KB
testcase_01 AC 140 ms
54,380 KB
testcase_02 AC 136 ms
54,136 KB
testcase_03 AC 135 ms
54,180 KB
testcase_04 AC 135 ms
53,912 KB
testcase_05 AC 137 ms
54,188 KB
testcase_06 AC 138 ms
54,324 KB
testcase_07 AC 135 ms
54,016 KB
testcase_08 AC 135 ms
54,292 KB
testcase_09 AC 136 ms
53,992 KB
testcase_10 AC 139 ms
54,232 KB
testcase_11 AC 175 ms
54,416 KB
testcase_12 AC 172 ms
54,224 KB
testcase_13 AC 170 ms
54,184 KB
testcase_14 AC 177 ms
54,216 KB
testcase_15 AC 166 ms
54,364 KB
testcase_16 AC 163 ms
54,100 KB
testcase_17 AC 178 ms
54,480 KB
testcase_18 AC 165 ms
54,244 KB
testcase_19 AC 176 ms
54,100 KB
testcase_20 AC 173 ms
54,336 KB
testcase_21 AC 167 ms
54,292 KB
testcase_22 AC 165 ms
54,128 KB
testcase_23 AC 157 ms
54,188 KB
testcase_24 AC 165 ms
54,232 KB
testcase_25 AC 174 ms
54,252 KB
testcase_26 AC 144 ms
54,412 KB
testcase_27 AC 143 ms
54,180 KB
testcase_28 AC 138 ms
54,016 KB
testcase_29 AC 137 ms
54,108 KB
testcase_30 AC 168 ms
54,132 KB
testcase_31 AC 166 ms
54,444 KB
testcase_32 AC 158 ms
54,340 KB
testcase_33 AC 165 ms
53,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int max = 1000000000;
		int min = 0;
		int prev = 0;
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    if (i != 0) {
		        sb.append(" ");
		    }
		    if (i < n - k) {
		        if (i % 2 == 0) {
		            prev = min + i;
		        } else {
		            prev = max - i;
		        }
		    }
		    sb.append(prev);
		}
		System.out.println(sb);
	}
}
0