結果

問題 No.478 一般門松列列
ユーザー crazybbb3crazybbb3
提出日時 2017-01-31 09:23:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,994 bytes
コンパイル時間 2,141 ms
コンパイル使用メモリ 74,196 KB
実行使用メモリ 52,912 KB
最終ジャッジ日時 2023-08-25 13:48:00
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,408 KB
testcase_01 AC 43 ms
49,432 KB
testcase_02 AC 43 ms
49,504 KB
testcase_03 AC 43 ms
49,540 KB
testcase_04 AC 43 ms
49,624 KB
testcase_05 AC 44 ms
49,448 KB
testcase_06 AC 44 ms
49,512 KB
testcase_07 AC 42 ms
49,356 KB
testcase_08 AC 42 ms
49,468 KB
testcase_09 AC 42 ms
49,644 KB
testcase_10 AC 44 ms
49,500 KB
testcase_11 AC 96 ms
52,484 KB
testcase_12 AC 95 ms
51,908 KB
testcase_13 AC 97 ms
51,696 KB
testcase_14 AC 90 ms
52,892 KB
testcase_15 AC 97 ms
52,412 KB
testcase_16 AC 86 ms
52,048 KB
testcase_17 AC 97 ms
51,928 KB
testcase_18 AC 94 ms
52,912 KB
testcase_19 AC 96 ms
52,356 KB
testcase_20 AC 97 ms
52,436 KB
testcase_21 AC 93 ms
52,868 KB
testcase_22 AC 87 ms
51,532 KB
testcase_23 AC 78 ms
51,364 KB
testcase_24 AC 91 ms
51,416 KB
testcase_25 AC 94 ms
52,056 KB
testcase_26 AC 61 ms
50,040 KB
testcase_27 AC 77 ms
50,804 KB
testcase_28 AC 57 ms
49,800 KB
testcase_29 AC 57 ms
49,720 KB
testcase_30 AC 90 ms
51,896 KB
testcase_31 AC 87 ms
50,848 KB
testcase_32 AC 86 ms
52,536 KB
testcase_33 AC 85 ms
50,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        int n = ni(), k = ni();
        int[] a = {1, 3, 0, 2};

        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {
            if (i >= n - k) {
                ans[i] = a[(n - k - 1) % 4];
            } else {
                ans[i] = a[i % 4];
            }
        }

        for (int i = 0; i < n; i++) {
            if (i > 0) out.print(" ");
            out.print(ans[i]);
        }
        out.println();
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0