結果

問題 No.478 一般門松列列
ユーザー fal_rnd
提出日時 2017-01-27 22:41:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 4,220 ms
コンパイル使用メモリ 74,852 KB
実行使用メモリ 44,160 KB
最終ジャッジ日時 2024-12-23 16:27:15
合計ジャッジ時間 11,518 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicodercontest155;

import java.util.*;
public class C{
	static Scanner s = new Scanner(System.in);

	static int[] ar = {1,3,2,4};

	public static void main(String[] args) {
		int n=s.nextInt(),k=s.nextInt();
		int[] kadomatsu = new int[n];
		kadomatsu[0]=1;
		for(int i=1;i<n;i++) {
			kadomatsu[i]=ar[i%4];
			if(i>n-1-k)
				kadomatsu[i]=kadomatsu[i-1];
		}
		System.out.println(Arrays.toString(kadomatsu).replaceAll("[\\[\\] ]", "").replaceAll(",", " "));
	}
}
0