結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2018-02-09 19:01:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 211 ms / 5,000 ms |
コード長 | 638 bytes |
コンパイル時間 | 2,570 ms |
コンパイル使用メモリ | 74,248 KB |
実行使用メモリ | 41,800 KB |
最終ジャッジ日時 | 2024-10-08 00:22:56 |
合計ジャッジ時間 | 4,966 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.*;public class Main {static Scanner sc = new Scanner(System.in);public static void main(String[] args) {int w = sc.nextInt();int h = sc.nextInt();String c = sc.next();if (c.equals("B")) {for (int i=0; i<h; i++) {for (int j=0; j<w; j++) {int temp = i+j;if (temp%2==0) {System.out.print("B");}else {System.out.print("W");}}System.out.println();}}else {for (int i=0; i<h; i++) {for (int j=0; j<w; j++) {int temp = i+j;if (temp%2==0) {System.out.print("W");}else {System.out.print("B");}}System.out.println();}}}}