如果某行输入包括两个0,表示输入结束。这行不需要处理。 Output显示的方式是:用s个'-'表示一个水平线段,用s个'|'表示一个垂直线段。这种情况下,每一个数字需要占用s+2列和2s+3行。另外,在两个数字之间要输出一个空白的列。在输出完每一个数之后,输出一个空白的行。注意:输出中空白的地方都要用空格来填充。 Sample Input
2 12345 3 67890 0 0Sample Output
-- -- -- | | | | | | | | | | | | -- -- -- -- | | | | | | | | | | -- -- -- --- --- --- --- --- | | | | | | | | | | | | | | | | | | | | | | | | --- --- --- | | | | | | | | | | | | | | | | | | | | | | | | --- --- --- ---Hint数字(digit)指的是0,或者1,或者2……或者9。
数(number)由一个或者多个数字组成。
根据每个数字特征列出个数组,然后输出就好了。。
注意为0 的时候。
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
const int inf_int = 2e9;
const long long inf_ll = 2e18;
#define inf_add 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, rt<<1
#define Rson mid+1, R, rt<<1|1
const int maxn=5e2+10;
using namespace std;
typedef vector<int> vi ;
typedef long long ll;
typedef unsigned long long ull;
inline int read(){int ra,fh;char rx;rx=getchar(),ra=0,fh=1;
while((rx<'0'||rx>'9')&&rx!='-')rx=getchar();if(rx=='-')
fh=-1,rx=getchar();while(rx>='0'&&rx<='9')ra*=10,ra+=rx-48,
rx=getchar();return ra*fh;}
//#pragma comment(linker, "/STACK:102400000,102400000")
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
//0 1 2 3 4 5 6 7 8 9
int a1[10] ={1,0,1,1,0,1,1,1,1,1};
int ble[10]={1,0,0,0,1,1,1,0,1,1};
int bri[10]={1,1,1,1,1,0,0,1,1,1};
int c1[10] ={0,0,1,1,1,1,1,0,1,1};
int dle[10]={1,0,1,0,0,0,1,0,1,0};
int dri[10]={1,1,0,1,1,1,1,1,1,1};
int e1[10] ={1,0,1,1,0,1,1,0,1,1};
vi num;
int s,n;
int main()
{
while(cin>>s>>n)
{
num.clear();
if(s==0&&n==0)
{
break;
}
int t = n;
if(t==0)
num.push_back(0);
while(t)
{
num.push_back(t%10);
t/=10;
}
for(int i=num.size()-1;i>=0;i--)
{
cout<<" ";
if(a1[num[i]])
rep(k,0,s) cout<<"-";
else
rep(k,0,s) cout<<" ";
cout<<" ";
cout<<" ";
}
cout<<endl;
rep(i,0,s)
{
for(int k=num.size()-1;k>=0;k--)
{
if(ble[num[k]])
cout<<"|";
else
cout<<" ";
rep(k,0,s)
cout<<" ";
if(bri[num[k]])
cout<<"|";
else
cout<<" ";
cout<<" ";
}
cout<<endl;
}
for(int i=num.size()-1;i>=0;i--)
{
cout<<" ";
if(c1[num[i]])
rep(k,0,s) cout<<"-";
else
rep(k,0,s) cout<<" ";
cout<<" ";
cout<<" ";
}
cout<<endl;
rep(i,0,s)
{
for(int k=num.size()-1;k>=0;k--)
{
if(dle[num[k]])
cout<<"|";
else
cout<<" ";
rep(k,0,s)
cout<<" ";
if(dri[num[k]])
cout<<"|";
else
cout<<" ";
cout<<" ";
}
cout<<endl;
}
for(int i=num.size()-1;i>=0;i--)
{
cout<<" ";
if(e1[num[i]])
rep(k,0,s) cout<<"-";
else
rep(k,0,s) cout<<" ";
cout<<" ";
cout<<" ";
}
cout<<endl;
cout<<endl;
}
return 0;
}