QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#442219 | #8217. King's Dinner | Firmino | AC ✓ | 1ms | 3692kb | C++14 | 1.1kb | 2024-06-15 10:18:22 | 2024-06-15 10:18:23 |
Judging History
answer
#include <iostream>
using namespace std;
int n;
char mp[105][105];
void solve()
{
cin>>n;
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++) mp[i][j]='.';
if(n&1)
{
for (int i=2;i<=n;i+=3)
for (int j=1;j<=n;j+=2) mp[i][j]=mp[i-1][j]='#';
if(n%3==0){
for (int i=1;i<=n;i+=2) mp[n-1][i]=mp[n-2][i]='.';
for (int i=2;i<=n;i+=3) mp[n][i]=mp[n][i-1]=mp[n-2][i]=mp[n-2][i-1]='#';
}
if(n%3==1){
for (int i=2;i<=n;i+=3) mp[n][i]=mp[n][i-1]='#';
}
}
else
{
for (int i=2;i<=n;i+=3)
for (int j=1;j<=n-3;j+=2) mp[i][j]=mp[i-1][j]='#';
for (int i=1;i<=n;i+=2) mp[i][n-1]=mp[i][n]='#';
if(n%3==0){
for (int i=1;i<=n-3;i+=2) mp[n-1][i]=mp[n-2][i]='.';
for (int i=2;i<=n-3;i+=3) mp[n][i]=mp[n][i-1]=mp[n-2][i]=mp[n-2][i-1]='#';
mp[n-1][n-1]='.',mp[n][n]=mp[n][n-2]=mp[n-1][n-2]='#';
}
if(n%3==1){
mp[n-1][n-1]='.',mp[n][n]='#';
for (int i=2;i<=n-2;i+=3) mp[n][i]=mp[n][i-1]='#';
}
}
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++) putchar(mp[i][j]);
putchar('\n');
}
}
int main()
{
int t;cin>>t;
while(t--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3588kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3604kb
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: 1ms
memory: 3580kb
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: 3620kb
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: 1ms
memory: 3692kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... .....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed