結果

問題 No.1851 Regular Tiling
ユーザー tentententen
提出日時 2022-03-02 08:34:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,435 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 73,932 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2023-09-23 02:51:35
合計ジャッジ時間 7,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,332 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 167 ms
57,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        int[][] base = new int[][]{{0, 1, 1}, {1, 2, 2}, {1, 2, 2}};
        while (t-- > 0) {
            int h = sc.nextInt();
            int w = sc.nextInt();
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (j > 0) {
                        sb.append(" ");
                    }
                    sb.append(base[i % 3][j % 3]);
                }
                sb.append("\n");
            }
        }
        System.out.print(sb);
    }
    
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0