結果
問題 |
No.1851 Regular Tiling
|
ユーザー |
![]() |
提出日時 | 2022-02-25 21:58:21 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 500 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 2,416 ms |
コンパイル使用メモリ | 86,632 KB |
実行使用メモリ | 50,088 KB |
最終ジャッジ日時 | 2024-07-03 16:47:50 |
合計ジャッジ時間 | 8,837 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
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(); } }