QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#652761 | #1266. Visual Cube | gutongxing | AC ✓ | 0ms | 3656kb | C++14 | 2.4kb | 2024-10-18 19:06:04 | 2024-10-18 19:06:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
//#define int long long
namespace gtx{
// Fast IO
void read(int &x){
x = 0;int h = 1;char tmp;
do{tmp=getchar();if(tmp=='-')h*=-1;}while(!isdigit(tmp));
while(isdigit(tmp)) x*=10,x+=tmp-'0',tmp=getchar();
x*=h;
}
void read(char &x){do{x=getchar();}while(x==' '||x=='\n'||x=='\r');}
void write(char x){putchar(x);}
void write(int x){
if(x<0) putchar('-'),x=-x;int st[200]={0},tot=0;
do st[++tot]=x%10,x/=10; while(x);
while(tot){putchar(st[tot--]+'0');}
}
void write(int x,char y){write(x);write(y);}
#ifndef int
void read(long long &x){
x = 0;int h = 1;char tmp;
do{tmp=getchar();if(tmp=='-')h*=-1;}while(!isdigit(tmp));
while(isdigit(tmp)) x*=10,x+=tmp-'0',tmp=getchar();
x*=h;
}
void write(long long x){
if(x<0) putchar('-'),x=-x;int st[200]={0},tot=0;
do st[++tot]=x%10,x/=10; while(x);
while(tot){putchar(st[tot--]+'0');}
}
void write(long long x,char y){write(x);write(y);}
#endif
const int MAXN = 30*4+2;
char draw[MAXN][MAXN];
void GO(int x,int y){
if(x<=0||y<=0) return;
draw[x][y] = '+';
draw[x+1][y] = '|';
draw[x-1][y+1] = '/';
GO(x-2,y+2);
}
void GO1(int x,int y){
if(x<=0||y<=0) return;
draw[x][y] = '+';
draw[x-1][y+1] = '/';
GO1(x-2,y+2);
}
signed main(){
int a,b,c;
read(a);read(b);read(c);
int Kuan = 2*b+2*a+1;
int Chang = 2*b+2*c+1;
for(int i = 1;i<=Chang;i++){
for(int j = 1;j<=Kuan;j++){
draw[i][j] = '.';
}
}
for(int i = 1;i<=b;i++){
for(int j = 2*b+1-2*(i-1);j<=Kuan-2*(i-1);j++){
draw[2*i-1][j] = j&1?'+':'-';
if(draw[2*i-1][j]=='+'){
draw[2*i][j-1]='/';
}
}
}
for(int i = 1;i<=c+1;i++){
for(int j = 1;j<=2*a+1;j++){
draw[2*b+2*i-1][j] = j&1?'+':'-';
if(j&1){
draw[2*b+2*i][j] = '|';
}
}
}
for(int i = 1;i<=c+1;i++){
for(int j = 1;j<=2*a+1;j++){
draw[2*b+2*i-1][j] = j&1?'+':'-';
if(j&1){
draw[2*b+2*i][j] = '|';
}
}
}
for(int i = 1;i<=c;i++){
GO(2*b+2*i-1,2*a+1);
}
GO1(2*b+2*c+1,2*a+1);
for(int i = 1;i<=Chang;i++){
for(int j = 1;j<=Kuan;j++){
write(draw[i][j]);
}
write(endl);
}
return 0;
}
}
signed main(){
// freopen("draw.in","r",stdin);
// freopen("draw.out","w",stdout);
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int T = 1;
gtx::read(T);
while(T--) gtx::main();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
2 1 1 1 6 2 4
output:
..+-+ ././| +-+.+ |.|/. +-+.. ....+-+-+-+-+-+-+ .../././././././| ..+-+-+-+-+-+-+.+ ./././././././|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/. +-+-+-+-+-+-+.+.. |.|.|.|.|.|.|/... +-+-+-+-+-+-+....
result:
ok 18 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
50 16 19 7 1 8 12 5 15 16 12 9 14 9 2 11 8 11 8 2 1 20 8 16 3 2 7 1 3 17 7 13 13 11 5 9 5 11 10 3 19 4 6 13 17 9 9 17 8 14 3 11 9 4 2 9 6 5 4 9 1 12 8 18 4 7 2 13 3 9 1 13 17 17 11 3 9 2 13 5 7 2 6 18 14 14 14 11 5 12 14 16 7 1 5 19 10 16 9 1 9 8 6 11 7 18 12 20 10 10 16 13 17 12 9 9 9 17 10 2 12 1 ...
output:
......................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ...................................../././././././././././././././././| ....................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+.+ .................................../././././././././././././././././|/| ...............
result:
ok 1988 lines