QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#56437#2540. Build The GridlinakWA 152ms42408kbJava11829b2022-10-19 16:07:122022-10-19 16:07:15

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-19 16:07:15]
  • 评测
  • 测评结果:WA
  • 用时:152ms
  • 内存:42408kb
  • [2022-10-19 16:07:12]
  • 提交

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