結果

問題 No.1851 Regular Tiling
ユーザー ripityripity
提出日時 2022-02-25 21:58:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 2,839 ms
コンパイル使用メモリ 73,576 KB
実行使用メモリ 63,068 KB
最終ジャッジ日時 2023-09-16 16:51:40
合計ジャッジ時間 9,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
56,204 KB
testcase_01 AC 346 ms
60,368 KB
testcase_02 AC 388 ms
61,008 KB
testcase_03 AC 366 ms
61,344 KB
testcase_04 AC 358 ms
60,784 KB
testcase_05 AC 377 ms
60,492 KB
testcase_06 AC 394 ms
62,088 KB
testcase_07 AC 366 ms
59,948 KB
testcase_08 AC 375 ms
60,732 KB
testcase_09 AC 373 ms
63,068 KB
testcase_10 AC 384 ms
60,384 KB
testcase_11 AC 173 ms
56,356 KB
testcase_12 AC 181 ms
56,132 KB
testcase_13 AC 462 ms
62,424 KB
testcase_14 AC 455 ms
59,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    
    public static Scanner sc = new Scanner(System.in);
    public static PrintWriter pw = new PrintWriter(System.out);
    
    public static void main(String[] args) {
        
        int t = sc.nextInt();
        while( t > 0 ) {
            solve();
            t--;
        }
        
        pw.flush();
        
    }
    
    static void solve() {
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] g = {
            {2,2,1},
            {2,2,1},
            {1,1,0}
        };
        int idi = H%3 == 1 ? 2 : 0;
        int idj = W%3 == 1 ? 2 : 0;
        for( int i = 0; i < H; i++ ) {
            for( int j = 0; j < W; j++ ) {
                pw.print(g[(idi+i)%3][(idj+j)%3]+" ");
            }
            pw.println();
        }
        
        pw.println();
        
    }
    
}
0