QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#59176 | #2540. Build The Grid | Hongzy# | WA | 2ms | 3644kb | C++ | 824b | 2022-10-28 15:09:41 | 2022-10-28 15:09:43 |
Judging History
answer
#include<bits/stdc++.h>
#define M 505
using namespace std;
void Rd(int &res) {
res=0;
char c;
int fl=1;
while(c=getchar(),c<48)if(c=='-')fl=-1;
do res=(res<<1)+(res<<3)+(c^48);
while(c=getchar(),c>=48);
res*=fl;
}
int n,a[M][M];
int main() {
Rd(n);
int l=0,r=n-1;
for(int i=0; i<n; i++) {
if((n%3==0)&&(i==n-1)&&(n!=3)) {
for(int j=0; j<n; j++) {
if(n-j<=l)a[i][j]=1;
else a[i][j]=0;
}
} else {
if(i%3==0) {
for(int j=0; j<n; j++) {
if(n-j<=l)a[i][j]=1;
else a[i][j]=0;
}
l++;
} else {
for(int j=0; j<n; j++) {
if(j<r)a[i][j]=1;
else a[i][j]=0;
}
r--;
}
}
}
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
if(a[i][j]==0)printf("W");
else printf("B");
}
puts("");
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
3
output:
WWW BBW BWW
result:
ok accepted
Test #2:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
2
output:
WW BW
result:
ok accepted
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3440kb
input:
4
output:
WWWW BBBW BBWW WWWB
result:
wrong answer Q is not a permutation