結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-16 02:49:29 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,408 bytes |
| コンパイル時間 | 2,257 ms |
| コンパイル使用メモリ | 80,084 KB |
| 実行使用メモリ | 43,936 KB |
| 最終ジャッジ日時 | 2025-11-16 02:49:33 |
| 合計ジャッジ時間 | 3,603 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 7 |
ソースコード
import java.io.*;
// 処理
class Process {
private int W;
private int H;
private String C;
Process(int W, int H, String C) {
this.W = W;
this.H = H;
this.C = C;
}
String getResult() {
var result = new StringBuffer("");
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
switch(C) {
case "B":
result.append(((i + j) % 2 == 0) ? "B" : "W");
break;
case "W":
result.append(((i + j) % 2 == 0) ? "W" : "B");
break;
}
}
result.append("\n");
}
return result.toString();
}
}
public class Main {
public static void main(String[] args) throws IOException {
var bufferedReader = new BufferedReader(new InputStreamReader(System.in));
var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
// 入力
String[] input = bufferedReader.readLine().trim().split("[ ]+");
int W = Integer.parseInt(input[0]);
int H = Integer.parseInt(input[1]);
// 出力
printWriter.println((new Process(W, H, input[2])).getResult());
bufferedReader.close();
printWriter.close();
}
}