QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#403971 | #8217. King's Dinner | i_am_noob# | AC ✓ | 2ms | 3644kb | C++14 | 1.7kb | 2024-05-03 00:29:01 | 2024-05-03 00:29:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define pb push_back
#define all(a) a.begin(),a.end()
#define sz(a) ((int)a.size())
const int N=105,mod=1000000007;
int add(int x, int y){x+=y; if(x>=mod) x-=mod; return x;}
int sub(int x, int y){x-=y; if(x<0) x+=mod; return x;}
int mul(int x, int y){return 1ll*x*y%mod;}
int Pow(int x, ll y=mod-2){int res=1; for(; y; y>>=1,x=mul(x,x)) if(y&1) res=mul(res,x); return res;}
int n;
char a[N][N];
void solve(int x, int y, int m1, int m2){
if(m1%2==0&&m2%3==0){
for(int i=x; i<x+m1; i+=2) for(int j=y; j<y+m2; j+=3) a[i][j]=a[i][j+1]='#';
}
else if(m1%3==0&&m2%2==0){
for(int i=x; i<x+m1; i+=3) for(int j=y; j<y+m2; j+=2) a[i][j]=a[i+1][j]='#';
}
}
void ahcorz(){
cin >> n;
n++;
for(int i=0; i<n; ++i) for(int j=0; j<n; ++j) a[i][j]='.';
if(n%6==0){
solve(0,0,n,n);
}
else if(n%6==3){
solve(0,0,n-3,n);
solve(n-3,0,3,n-1);
}
else if(n%6==1){
solve(0,0,n-3,n-4);
solve(0,n-4,n-4,4);
solve(n-3,0,3,n-3);
solve(n-4,n-3,4,3);
}
else if(n%6==5){
solve(0,0,n-2,n-3);
solve(0,n-3,n-3,3);
solve(n-2,0,2,n-2);
solve(n-3,n-2,3,2);
}
else if(n%6==2){
solve(0,0,n-2,n);
solve(n-2,0,2,n-2);
}
else if(n%6==4){
solve(0,0,n-4,n);
solve(n-4,0,4,n-1);
}
for(int i=0; i<n-1; ++i){
for(int j=0; j<n-1; ++j) cout << a[i][j];
cout << '\n';
}
}
signed main(){
ios_base::sync_with_stdio(0),cin.tie(0);
int t; cin >> t;
while(t--){
ahcorz();
}
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3 1 2 3
output:
. #. #. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
50 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
output:
. #. #. ##. ... ##. #.## #... ...# ##.# ##.## ..... ##.## ..... ##.## ##.#.# ...#.# ##.... ....## #.#... #.#.## #.#.#.# #.#.#.# ....... #.#.#.# #.#.#.# ....... ##.##.. ##.##.## ........ ##.##.## ........ ##.##.## ........ #.#.#.#. #.#.#.#. #.#.#.#.# #.#.#.#.# ......... #.#.#.#.# #.#.#.#.# ......... ...
result:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ................................................... #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...........................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.#.# .......................................................................................#.# ##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.... ..............................
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... .....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed