QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#577950 | #8217. King's Dinner | ucup-team3519# | WA | 0ms | 3704kb | C++20 | 2.2kb | 2024-09-20 15:38:07 | 2024-09-20 15:38:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int a[205][205];
void init(int n){
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)a[i][j]=0;
}
void output(int n){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][j])cout<<"#";
else cout<<"*";
}
cout<<'\n';
}
}
void draw(int x,int y,int lenx,int leny){
// if(lenx==0||leny==0)return;
if(lenx==leny&&lenx!=6){
if(lenx<=2)return;
if(lenx==3){
draw(x,y,2,3);
return;
}
if(lenx==4){
draw(x,y,3,4);
return;
}
if(lenx==5){
draw(x,y,2,3);
draw(x+2,y,3,2);
draw(x,y+3,3,2);
draw(x+3,y+2,2,3);
return;
}
if(lenx==7){
draw(x,y,3,4);
draw(x+3,y,4,3);
draw(x,y+4,4,3);
draw(x+4,y+3,3,4);
return;
}
if(lenx>7){
draw(x,y,6,6);
draw(x+6,y,lenx-6,6);
draw(x,y+6,6,leny-6);
draw(x+6,y+6,lenx-6,leny-6);
return;
}
}
assert(lenx*leny%6==0);
if(lenx==2&&leny==3){
a[x][y]=a[x][y+1]=1;
return;
}
if(lenx==3&&leny==2){
a[x][y]=a[x+1][y]=1;
return;
}
if(lenx%2==0&&leny%3==0){
for(int i=x;i<x+lenx;i+=2){
for(int j=y;j<y+leny;j+=3){
draw(i,j,2,3);
}
}
return;
}
if(lenx%3==0&&leny%2==0){
for(int i=x;i<x+lenx;i+=3){
for(int j=y;j<y+leny;j+=2){
draw(i,j,3,2);
}
}
return;
}
if(lenx%6==0){
draw(x,y,lenx,2);
draw(x,y+2,lenx,leny-2);
return;
}
if(leny%6==0){
draw(x,y,2,leny);
draw(x+2,y,lenx-2,leny);
return;
}
assert(0);
}
void solve(){
int n;
cin>>n;
n++;
init(n);
draw(0,0,n,n);
output(n-1);
}
int main() {
ios::sync_with_stdio(0),cin.tie(0);
int t;
cin>>t;
while(t--){
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
input:
3 1 2 3
output:
* ## ** #*# #*# ***
result:
wrong answer Token parameter [name=row of the grid] equals to "*", doesn't correspond to pattern "[#.]+" (test case 1)