結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
kaoetaya
|
| 提出日時 | 2016-11-10 15:24:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 166 ms / 5,000 ms |
| コード長 | 780 bytes |
| コンパイル時間 | 3,345 ms |
| コンパイル使用メモリ | 77,416 KB |
| 実行使用メモリ | 54,072 KB |
| 最終ジャッジ日時 | 2024-11-25 07:10:37 |
| 合計ジャッジ時間 | 5,190 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
import java.util.Scanner;
public class pre {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int w = s.nextInt(),h = s.nextInt();
String c = s.next();
String[] str = new String[w*h];
for(int i=0;i<w*h;i++){
if(i >= w && i%w == 0 && str[i-1].equals("B") && w%2 == 0){
str[i] = "B";
}
else if(i >= w && i%w == 0 && str[i-1].equals("W") && w%2 == 0){
str[i] = "W";
}
else if(c.equals("B")){
str[i] = c;
c = "W";
}
else if(c.equals("W")){
str[i] = c;
c = "B";
}
}
int cnt=0;
for(int i=0;i<w*h;i++){
if(cnt == w){
System.out.println();
cnt = 0;
System.out.print(str[i]);
cnt++;
}
else{
System.out.print(str[i]);
cnt++;
}
}
}
}
kaoetaya