QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#56437 | #2540. Build The Grid | linak | WA | 152ms | 42408kb | Java11 | 829b | 2022-10-19 16:07:12 | 2022-10-19 16:07:15 |
Judging History
answer
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int a=Integer.parseInt(bf.readLine());
char[][] k=new char[a][a];
Arrays.fill(k[0],'W');
int p=1;
for(int i=1; i<a; i++){
for(int j=0; j<i; j++) k[p][j]='W';
for(int j=i; j<a; j++) k[p][j]='B';
p++;
if(p==a) break;
for(int j=0; j<i; j++) k[p][j]='B';
for(int j=i; j<a; j++) k[p][j]='W';
p++;
if(p==a) break;
}
for(int i=0; i<a; i++){
for(int j=0; j<a; j++) System.out.print(k[i][j]);
System.out.println();
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 152ms
memory: 42408kb
input:
3
output:
WWW WBB BWW
result:
wrong answer white cells are not connected