QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#577950#8217. King's Dinnerucup-team3519#WA 0ms3704kbC++202.2kb2024-09-20 15:38:072024-09-20 15:38:07

Judging History

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

  • [2024-09-20 15:38:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-09-20 15:38:07]
  • 提交

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();
    }
}    

Details

Tip: Click on the bar to expand more detailed information

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)