174 条题解
-
0Star_LiuSan LV 4 @ 2006-04-27 17:03:37
我知道了。
最前面没空格!
我搞了这么久啊!!!
但题目却说每个数字之前有空格。
惨啊。 -
02006-03-17 18:54:50@
每一行最后都没有空格哦!
-
02006-03-16 20:39:33@
不难~~~~
38lines -
02006-09-03 13:50:02@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02006-02-09 14:50:35@
貌似是左右括号匹配问题改编的。
-
02006-02-09 14:15:19@
这个……注意点就不会错了吧
虽说我代码写了200多行~~~~(当然全都是copy+paste了) -
02006-02-05 16:39:52@
似乎仅仅是范围变大以及输入格式不同了....
小小的改动让我WA3次..我真够可以...
-
02006-01-27 21:08:34@
POJ1102,略有改动
-
-12017-08-02 03:47:03@
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int k;
int main()
{
string a;
cin>>k;
cin>>a;
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
cout<<endl;
for(int j=1;j<=k;++j)
{
for(int i=0;i<=a.size()-1;++i)
{
if(a[i]=='1')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='2'||a[i]=='3'||a[i]=='7')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='4'||a[i]=='8'||a[i]=='9'||a[i]=='0')
{
cout<<"|";
for(int w=1;w<=k;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='5'||a[i]=='6')
{
cout<<"|";
for(int w=1;w<=k+1;++w)cout<<" ";
}
cout<<" ";
}
cout<<endl;
}
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]=='7'||a[i]=='0')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='0'&&a[i]!='7'&&a[i]!='1')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
cout<<endl;
for(int j=1;j<=k;++j)
{
for(int i=0;i<=a.size()-1;++i)
{
if(a[i]=='1')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='3'||a[i]=='4'||a[i]=='5'||a[i]=='7'||a[i]=='9')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='6'||a[i]=='8'||a[i]=='0')
{
cout<<"|";
for(int w=1;w<=k;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='2')
{
cout<<"|";
for(int w=1;w<=k+1;++w)cout<<" ";
}
cout<<" ";
}
cout<<endl;
}
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";;
if(a[i]=='4'||a[i]=='7')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='1'&&a[i]!='4'&&a[i]!='7')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
return 0;
} -
-12017-08-02 03:47:01@
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int k;
int main()
{
string a;
cin>>k;
cin>>a;
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
cout<<endl;
for(int j=1;j<=k;++j)
{
for(int i=0;i<=a.size()-1;++i)
{
if(a[i]=='1')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='2'||a[i]=='3'||a[i]=='7')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='4'||a[i]=='8'||a[i]=='9'||a[i]=='0')
{
cout<<"|";
for(int w=1;w<=k;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='5'||a[i]=='6')
{
cout<<"|";
for(int w=1;w<=k+1;++w)cout<<" ";
}
cout<<" ";
}
cout<<endl;
}
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]=='7'||a[i]=='0')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='0'&&a[i]!='7'&&a[i]!='1')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
cout<<endl;
for(int j=1;j<=k;++j)
{
for(int i=0;i<=a.size()-1;++i)
{
if(a[i]=='1')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='3'||a[i]=='4'||a[i]=='5'||a[i]=='7'||a[i]=='9')
{
for(int w=1;w<=k+1;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='6'||a[i]=='8'||a[i]=='0')
{
cout<<"|";
for(int w=1;w<=k;++w)cout<<" ";
cout<<"|";
}
if(a[i]=='2')
{
cout<<"|";
for(int w=1;w<=k+1;++w)cout<<" ";
}
cout<<" ";
}
cout<<endl;
}
for(int i=0;i<=a.size()-1;++i)
{
if(i==0)cout<<" ";
if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";;
if(a[i]=='4'||a[i]=='7')for(int w=1;w<=k;++w)cout<<" ";
if(a[i]!='1'&&a[i]!='4'&&a[i]!='7')for(int w=1;w<=k;++w)cout<<"-";
cout<<" ";
}
return 0;
} -
-12016-08-06 15:05:32@
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long lg; #define min(a,b) (a>b?b:a) #define max(a,b) (a>b?a:b) int k; string s; char a[70][25500]; void do1(int l,int r) { //cout<<l<<" "<<r<<endl; for(int i=2;i<2+k;i++) a[i][l]='|'; } void do6(int l,int r) { for(int i=3+k;i<k*2+3;i++) a[i][l]='|'; } void do3(int l,int r) { for(int i=2;i<2+k;i++) a[i][r]='|'; } void do4(int l,int r) { for(int i=3+k;i<k*2+3;i++) a[i][r]='|'; } void do2(int l,int r) { for(int i=l+1;i<r;i++) a[1][i]='-'; } void do7(int l,int r) { for(int i=l+1;i<r;i++) a[k+2][i]='-'; } void do5(int l,int r) { for(int i=l+1;i<r;i++) a[2*k+3][i]='-'; } void out(int t,int p,int z) { if((t>3&&t!=7)||t==0) do1(p,z); if(t!=1&&t!=4) do2(p,z); if(t!=5&&t!=6) do3(p,z); if(t!=2) do4(p,z); if(t!=1&&t!=4&&t!=7) do5(p,z); if(t!=1&&t!=3&&t!=4&&t!=5&&t!=7&&t!=9) do6(p,z); if(t!=1&&t!=7&&t!=0) do7(p,z); } int main(int argc, char** argv) { memset(a,' ',sizeof a); cin>>k>>s; int ss=2; for(int i=0;i<int(s.size());i++) { out(s[i]-'0',ss,ss+k+1); ss+=k+3; } for(int j=1;j<=2*k+3;j++) { for(int i=2;i<ss;i++) cout<<a[j][i]; cout<<endl; } return 0; }
-
-12016-08-05 17:39:59@
#include <iostream> #include <cstring> #include <cstdio> using namespace std; int k,st; char s[256]; int main() { scanf("%d",&k); st=k; cin>>s; for (int l=1;l<=5;l++) { if (l==1 || l==3 || l==5) st=1; else st=k; for (int j = 1; j <= st; j++) { for (int i=0;i<strlen(s);i++) { if (l==1) { if (i==0) cout<<" "; if (s[i]!='4' && s[i]!='1') {for (int i=1;i<=k;i++) cout<<"-"; cout<<" "; } else {for (int q=1;q<=k;q++) cout<<" "; cout<<" ";} } if (l==2) { if (s[i] == '2' || s[i] == '3' || s[i] == '7' || s[i] == '1') { cout<<" "; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; } else if (s[i] == '5' || s[i] == '6') { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<" "; } else { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; } } if (l==3) { if (i==0) cout<<" "; if (s[i] == '7' || s[i] == '0' || s[i] == '1') {for (int q=1;q<=k;q++) cout<<" "; cout<<" ";} else {for (int q=1;q<=k;q++) cout<<"-"; cout<< " ";} } if (l==4) { if (s[i] == '4' || s[i] == '3' || s[i] == '7' || s[i] == '9' || s[i] == '5' || s[i] == '1') { cout<<" "; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; } else if (s[i] == '2') { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<" "; } else { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; } } if (l==5) { if (i==0) cout<<" "; if (s[i]!='4' && s[i]!='1' && s[i]!='7') {for (int i=1;i<=k;i++) cout<<"-"; cout<<" "; } else {for (int q=1;q<=k;q++) cout<<" "; cout<<" ";} } } cout<<endl; } } }
应为没有注意到**1与其他数字同宽**而WA了一次,坑我啊!!
-
-12014-11-29 14:19:27@
#include<stdio.h>
#include<string.h>
int main(){
int k[64][1000]={0},i,j,h,n,sum,p=1;//定义k数组,不用符号做,0代表' ',1代表'-',2代表'|'.
char s,array[300];
scanf("%d",&h);
scanf("%s",array);
for(j=0;j<strlen(array);j++){
if(array[j]=='0'){
for(i=p;i<p+h;i++){k[0][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i][p+h]=k[i+h+1][p-1]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='8'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i][p+h]=k[i+h+1][p-1]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='6'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i+h+1][p-1]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='9'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i][p+h]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='3'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p+h]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='2'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p+h]=k[i+h+1][p-1]=2;}
p+=(h+3);
}
else if(array[j]=='5'){
for(i=p;i<p+h;i++){k[0][i]=k[h+1][i]=k[2*h+2][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='1'){
for(i=1;i<=h;i++){k[i][p+h]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='4'){
for(i=p;i<p+h;i++){k[h+1][i]=1;}
for(i=1;i<=h;i++){k[i][p-1]=k[i][p+h]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
else if(array[j]=='7'){
for(i=p;i<p+h;i++){k[0][i]=1;}
for(i=1;i<=h;i++){k[i][p+h]=k[i+h+1][p+h]=2;}
p+=(h+3);
}
}for(i=0;i<=2*h+2;i++){
for(j=0;j<p-2;j++){
if(k[i][j]==0)printf("%c",32);
else if(k[i][j]==1)printf("%c",45);
else if(k[i][j]==2)printf("%c",124);
}
printf("\n");}
return 0;
} -
-22016-04-03 23:26:52@
可以发现,整个图形需要5部分,逐层模拟即可。
、、、pascal
const
p:array ['0'..'9']of string[5]=('-d d-', ' r r ', '-r-l-', '-r-r-', ' d-r ', '-l-r-', '-l-d-', '-r r ', '-d-d-', '-d-r-');
var
i,j,k:byte;
s:string;
a:array [1..5] of ansistring;
procedure fct(o:string);
begin
for j:=1 to 5 do
case o[j] of
'-': a[j]:=a[j]+' '+stringofchar('-', k)+' ';
'l': a[j]:=a[j]+'|'+stringofchar(' ', k+2);
'r': a[j]:=a[j]+stringofchar(' ', k+1)+'| ';
'd': a[j]:=a[j]+'|'+stringofchar(' ', k)+'| ';
' ': a[j]:=a[j]+stringofchar(' ', k+3)
end;
end;
begin
readln(k);
readln(s);
for i:=1 to length(s) do fct(p[s[i]]);
for i:=1 to 5 do delete(a[i],length(a[i]),1);
writeln(a[1]);
for i:=1 to k do writeln(a[2]);
writeln(a[3]);
for i:=1 to k do writeln(a[4]);
write(a[5]);
end.
、、、