标签:stream ++ asc main queue printf space 问题 tac
题解:普通的a+b才怪问题,需要绘制出来,方法有点麻烦。
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <stack>
#include <stack>
using namespace std;
char s[10][200],s2[10][200];
char num[7][11][6] = {
"xxxxx","....x","xxxxx","xxxxx","x...x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx",".....",
"x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
"x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
"x...x","....x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx","....x","xxxxx","xxxxx","xxxxx",
"x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
"x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
"xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....."};
int f[15];
void cmp(int l,int r,int x)
{
int i,j;
for(i=0;i<=10;i++)
{
if(!f[i])
continue;
for(j=0;j<5;j++)
{
if(s[x][l+j]!=num[x][i][j])
break;
}
if(j!=5)
f[i] = 0;
}
}
int read(int l,int r)
{
int i;
for(i=0;i<=10;i++)
f[i] = 1;
for(i=0;i<7;i++)
cmp(l,r,i);
for(i=0;i<=10;i++)
{
if(f[i])
return i;
}
return -1;
}
long long c;
void show(long long x,int a)
{
if(x>=10)
show(x/10,a);
if(x!=c)
printf("%s.",num[a][x%10]);
else
printf("%s\n",num[a][x%10]);
}
int main()
{
int i;
long long a,b,n,sum;
for(i=0;i<7;i++)
scanf("%s",s[i]);
n = strlen(s[0]);
a = b = 0;
sum = 0;
for(i=0;i<n;i+=6)
{
c = read(i,i+5);
if(c==10)
{
a = sum;
sum = 0;
}
else
{
sum *= 10;
sum += c;
}
}
b = sum;
c = a + b;
for(i=0;i<7;i++)
show(c,i);
return 0;
}
标签:stream ++ asc main queue printf space 问题 tac
原文地址:https://www.cnblogs.com/luoxiaoyi/p/9770950.html