結果
| 問題 |
No.1851 Regular Tiling
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2022-02-25 22:13:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 2,000 ms |
| コード長 | 638 bytes |
| コンパイル時間 | 276 ms |
| コンパイル使用メモリ | 41,540 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-03 17:05:38 |
| 合計ジャッジ時間 | 2,191 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 1851.cc: No.1851 Regular Tiling - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
/* global variables */
inline int cell(int y, int x) {
return (y % 3 > 0 ? 1 : 0) + (x % 3 > 0 ? 1 : 0);
}
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int h, w;
scanf("%d%d", &h, &w);
int y0 = (h % 3 == 2) ? 1 : 0;
int x0 = (w % 3 == 2) ? 1 : 0;
for (int y = 0; y < h; y++)
for (int x = 0; x < w; x++)
printf("%d%c", cell(y + y0, x + x0), (x + 1 < w) ? ' ' : '\n');
}
return 0;
}
tnakao0123