結果

問題 No.478 一般門松列列
ユーザー 37zigen37zigen
提出日時 2017-01-28 01:25:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 365 ms / 2,000 ms
コード長 790 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 73,344 KB
実行使用メモリ 64,988 KB
最終ジャッジ日時 2023-08-25 11:48:47
合計ジャッジ時間 12,143 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,776 KB
testcase_01 AC 117 ms
56,112 KB
testcase_02 AC 117 ms
55,820 KB
testcase_03 AC 117 ms
55,920 KB
testcase_04 AC 122 ms
55,696 KB
testcase_05 AC 119 ms
53,784 KB
testcase_06 AC 126 ms
53,492 KB
testcase_07 AC 125 ms
55,560 KB
testcase_08 AC 119 ms
55,912 KB
testcase_09 AC 118 ms
55,784 KB
testcase_10 AC 120 ms
56,180 KB
testcase_11 AC 365 ms
64,448 KB
testcase_12 AC 358 ms
64,988 KB
testcase_13 AC 363 ms
64,508 KB
testcase_14 AC 364 ms
64,344 KB
testcase_15 AC 354 ms
64,520 KB
testcase_16 AC 264 ms
63,184 KB
testcase_17 AC 352 ms
64,572 KB
testcase_18 AC 302 ms
64,564 KB
testcase_19 AC 361 ms
64,592 KB
testcase_20 AC 352 ms
64,192 KB
testcase_21 AC 315 ms
64,504 KB
testcase_22 AC 274 ms
64,384 KB
testcase_23 AC 275 ms
64,300 KB
testcase_24 AC 303 ms
64,376 KB
testcase_25 AC 341 ms
64,220 KB
testcase_26 AC 226 ms
59,316 KB
testcase_27 AC 227 ms
60,288 KB
testcase_28 AC 188 ms
55,992 KB
testcase_29 AC 182 ms
55,992 KB
testcase_30 AC 288 ms
64,572 KB
testcase_31 AC 271 ms
64,368 KB
testcase_32 AC 251 ms
60,444 KB
testcase_33 AC 266 ms
64,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.*;
import java.util.concurrent.SynchronousQueue;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int upper = 1_000_000_00;
		int lower = upper - 1;
		int pre = -1;
		for (int i = 0; i < n - k; ++i) {
			if (i % 2 == 0) {
				System.out.print(upper);
				pre = upper;
				++upper;
			} else {
				System.out.print(lower);
				pre = lower;
				--lower;
			}
			if (i != n - 1)
				System.out.print(" ");
		}
		for (int i = n - k; i < n; ++i) {	
			System.out.print(pre);
			if (i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0