結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2017-09-24 15:29:20 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 177 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 3,229 ms |
コンパイル使用メモリ | 76,760 KB |
実行使用メモリ | 55,272 KB |
最終ジャッジ日時 | 2024-11-14 07:09:20 |
合計ジャッジ時間 | 4,644 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
import java.util.Scanner;public class Main{private static char change(char c){if(c=='B')return 'W';else return 'B';}public static void main(String args[])throws Exception{Scanner sc=new Scanner(System.in);String s[]=sc.nextLine().split(" ");int w=Integer.parseInt(s[0]);int h=Integer.parseInt(s[1]);char c=s[2].charAt(0);String s1="",s2="";for(int i=0;i<w;i++){s1+=c;c=change(c);s2+=c;}for(int i=0;i<h;i++){if(i%2==0)System.out.println(s1);elseSystem.out.println(s2);}}}