結果

問題 No.82 市松模様
ユーザー リチウムリチウム
提出日時 2014-12-02 23:30:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 595 bytes
コンパイル時間 3,188 ms
コンパイル使用メモリ 73,224 KB
実行使用メモリ 56,448 KB
最終ジャッジ日時 2023-09-02 01:07:21
合計ジャッジ時間 5,330 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,992 KB
testcase_01 AC 123 ms
55,860 KB
testcase_02 AC 123 ms
55,820 KB
testcase_03 AC 121 ms
55,788 KB
testcase_04 AC 129 ms
56,356 KB
testcase_05 AC 124 ms
55,824 KB
testcase_06 AC 132 ms
55,800 KB
testcase_07 AC 153 ms
55,728 KB
testcase_08 AC 180 ms
55,800 KB
testcase_09 AC 179 ms
56,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.Math.*;
 
public class ppp {
	
	
		
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  int n=sc.nextInt();
	  int m=sc.nextInt();
	  String c=sc.next();
	  int x=0;
	  if(c.equals("B"))x++;
	  char a[][]=new char[m][n];
	  for(int i=0;i<m;i++){
		  for(int j=0;j<n;j++){
			  if((i+j+x)%2==1){
				  a[i][j]='B';
			  }
			  else a[i][j]='W';
		  }
	  }
	  for(int i=0;i<m;i++){
		  for(int j=0;j<n;j++){
			  	  
		  System.out.print(a[i][j]);
		  }
		  System.out.println();
	  }
  }}
0