結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2014-12-03 12:04:38 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 195 ms / 5,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 3,399 ms |
コンパイル使用メモリ | 77,756 KB |
実行使用メモリ | 41,592 KB |
最終ジャッジ日時 | 2024-06-11 14:41:24 |
合計ジャッジ時間 | 4,457 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int yoko=sc.nextInt(); int tate=sc.nextInt(); String sa = sc.next(); char[][] ans = new char[tate][yoko]; ans[0][0]=sa.charAt(0); for(int i=0;i<yoko;i++){ if(i!=0){ if(ans[0][i-1]=='W'){ ans[0][i]='B'; }else{ ans[0][i]='W'; } } for(int j=1;j<tate;j++){ if(ans[j-1][i]=='B'){ ans[j][i]='W'; }else{ ans[j][i]='B'; } } } for(int i=0;i<tate;i++){ for(int j=0;j<yoko;j++){ System.out.print(ans[i][j]); } System.out.println(""); } } }