大海中的孤帆 @ 2023-02-03 19:36:23
样例输入 10 0123456789 样例输出 XXX...X.XXX.XXX.X.X.XXX.XXX.XXX.XXX.XXX X.XXX.X.X.XXX.XXX.XXX.XXX.XXX.X.X.X.X.X XXX.XXX.XXX.XXX.XXX.X.X.X.X.X.X.XXX.XXX X.XXX.XXX.X.X.X.X.X.X.XXX.XXX.X.X.X...X X.X.X.X.X.X.XXX.XXX.X.X.X...X.X.XXX.XXX
#include<bits/stdc++.h>
using namespace std;
char f[10010][10];
void p0(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='.';
f[x+2][y+2]='X';
f[x+3][y]='X';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p1(int x,int y)
{
f[x][y]='.';
f[x][y+1]='.';
f[x][y+2]='X';
f[x+1][y]='.';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='.';
f[x+2][y+1]='.';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='.';
f[x+4][y+1]='.';
f[x+4][y+2]='X';
}
void p2(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='.';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='X';
f[x+3][y+1]='.';
f[x+3][y+2]='.';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p3(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='.';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p4(int x,int y)
{
f[x][y]='X';
f[x][y+1]='.';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='.';
f[x+4][y+1]='.';
f[x+4][y+2]='X';
}
void p5(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='.';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p6(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='.';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='X';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p7(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='.';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='.';
f[x+2][y+1]='.';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='.';
f[x+4][y+1]='.';
f[x+4][y+2]='X';
}
void p8(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='X';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
void p9(int x,int y)
{
f[x][y]='X';
f[x][y+1]='X';
f[x][y+2]='X';
f[x+1][y]='X';
f[x+1][y+1]='.';
f[x+1][y+2]='X';
f[x+2][y]='X';
f[x+2][y+1]='X';
f[x+2][y+2]='X';
f[x+3][y]='.';
f[x+3][y+1]='.';
f[x+3][y+2]='X';
f[x+4][y]='X';
f[x+4][y+1]='X';
f[x+4][y+2]='X';
}
int main()
{
int n;
string s;
cin>>n>>s;
int l=s.size();
int y=-1;
for(int i=0;i<l;++i)
{
y++;
if(s[i]=='0')
p0(0,y);
else if(s[i]=='1')
p1(0,y);
else if(s[i]=='2')
p2(0,y);
else if(s[i]=='3')
p3(0,y);
else if(s[i]=='4')
p4(0,y);
else if(s[i]=='5')
p5(0,y);
else if(s[i]=='6')
p6(0,y);
else if(s[i]=='7')
p7(0,y);
else if(s[i]=='8')
p8(0,y);
else
p9(0,y);
y+=3;
if(y!=l-1)
for(int j=0;j<5;++j)
f[j][y]='.';
}
for(int i=0;i<5;++i)
{
for(int j=0;j<y;++j)
{
cout<<f[i][j];
}
cout<<endl;
}
return 0;
}
by Libingyue2011 @ 2023-02-04 19:21:57
我是暴力中的暴力
#include<bits/stdc++.h>
using namespace std;
int n;
char a[110];
int main() {
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<n;i++){
if(a[i]=='0')
cout<<"XXX.";
if(a[i]=='1')
cout<<"..X.";
if(a[i]=='2'||a[i]=='3'||a[i]=='5'||a[i]=='6'||a[i]=='7'||a[i]=='8'||a[i]=='9')
cout<<"XXX.";
if(a[i]=='4')
cout<<"X.X.";
}
if(a[n]=='0')
cout<<"XXX";
if(a[n]=='1')
cout<<"..X";
if(a[n]=='2'||a[n]=='3'||a[n]=='5'||a[n]=='6'||a[n]=='7'||a[n]=='8'||a[n]=='9')
cout<<"XXX";
if(a[n]=='4')
cout<<"X.X";
cout<<endl;
for(int i=1;i<n;i++){
if(a[i]=='0'||a[i]=='4'||a[i]=='8'||a[i]=='9')
cout<<"X.X.";
if(a[i]=='1'||a[i]=='7')
cout<<"..X.";
if(a[i]=='2'||a[i]=='3')
cout<<"..X.";
if(a[i]=='5'||a[i]=='6')
cout<<"X...";
}
if(a[n]=='0'||a[n]=='4'||a[n]=='8'||a[n]=='9')
cout<<"X.X";
if(a[n]=='1'||a[n]=='7')
cout<<"..X";
if(a[n]=='2'||a[n]=='3')
cout<<"..X";
if(a[n]=='5'||a[n]=='6')
cout<<"X..";
cout<<endl;
for(int i=1;i<n;i++){
if(a[i]=='0')
cout<<"X.X.";
if(a[i]=='1'||a[i]=='7')
cout<<"..X.";
if(a[i]=='2'||a[i]=='3'||a[i]=='4'||a[i]=='5'||a[i]=='6'||a[i]=='8'||a[i]=='9')
cout<<"XXX.";
}
if(a[n]=='0')
cout<<"X.X";
if(a[n]=='1'||a[n]=='7')
cout<<"..X";
if(a[n]=='2'||a[n]=='3'||a[n]=='4'||a[n]=='5'||a[n]=='6'||a[n]=='7'||a[n]=='9')
cout<<"XXX";
cout<<endl;
for(int i=1;i<n;i++){
if(a[i]=='0'||a[i]=='6'||a[i]=='8')
cout<<"X.X.";
if(a[i]=='1'||a[i]=='7'||a[i]=='3'||a[i]=='4'||a[i]=='5')
cout<<"..X.";
if(a[i]=='2')
cout<<"X...";
if(a[i]=='9')
cout<<"..X.";
}
if(a[n]=='0'||a[n]=='6'||a[n]=='8')
cout<<"X.X";
if(a[n]=='1'||a[n]=='7'||a[n]=='3'||a[n]=='4'||a[n]=='5')
cout<<"..X";
if(a[n]=='2')
cout<<"X..";
if(a[n]=='9')
cout<<"..X";
cout<<endl;
for(int i=1;i<n;i++){
if(a[i]=='0'||a[i]=='2'||a[i]=='3'||a[i]=='5'||a[i]=='6'||a[i]=='8'||a[i]=='9')
cout<<"XXX.";
if(a[i]=='1'||a[i]=='4'||a[i]=='7')
cout<<"..X.";
}
if(a[n]=='0'||a[n]=='2'||a[n]=='3'||a[n]=='5'||a[n]=='6'||a[n]=='8'||a[n]=='9')
cout<<"XXX";
if(a[n]=='1'||a[n]=='4'||a[n]=='7')
cout<<"..X";
return 0;
}
by Lcq2011 @ 2023-09-13 19:53:16
你这是非常的暴力呀