Posted: Wed Oct 27, 2004 1:04 am
Hello,
try this input:
10 99999999
10 12345678
try this input:
10 99999999
10 12345678
it works... with the new code, which is posted in the other topicafonsocsc wrote:Hello,
try this input:
10 99999999
10 12345678
this is new code, fixed the problems u have mentioned, but still WAafonsocsc wrote:Hi,
I did a diff with your output and mine and here's the result:
Your program is printing one extra blank line in the beginning, and is adding one extra space at the end of each line.
Hope it helps
Code: Select all
----------
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
----------
----- -----
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
----- -----
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
----- -----
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
--- --- --- --- ---
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
--- --- --- --- ---
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
--- --- --- --- ---
-
| |
| |
-
--
| |
| |
| |
| |
--
---
| |
| |
| |
| |
| |
| |
---
-------- --------
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
-------- -------- --------
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
-------- --------
-- -- --
| | | | |
| | | | |
| | | | |
| | | | |
-- --
Code: Select all
......--...--........--.
...|....|....|.|..|.|...
...|....|....|.|..|.|...
......--...--...--...--.
...|.|.......|....|....|
...|.|.......|....|....|
......--...--........--.
.---...---...---...---...---.
|.........|.|...|.|...|.|...|
|.........|.|...|.|...|.|...|
|.........|.|...|.|...|.|...|
.---.........---...---.......
|...|.....|.|...|.....|.|...|
|...|.....|.|...|.....|.|...|
|...|.....|.|...|.....|.|...|
.---.........---...---...---.
.----------...----------...----------...----------...----------...----------...----------...----------.
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|.|..........|
.----------...----------...----------...----------...----------...----------...----------...----------.
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
...........|............|............|............|............|............|............|............|
.----------...----------...----------...----------...----------...----------...----------...----------.
.----------.
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
............
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
|..........|
.----------.
.........-----...-----.........
......|.|.....|.|.....|.|.....|
......|.|.....|.|.....|.|.....|
......|.|.....|.|.....|.|.....|
......|.|.....|.|.....|.|.....|
......|.|.....|.|.....|.|.....|
.................-----...-----.
......|.|.....|.......|.......|
......|.|.....|.......|.......|
......|.|.....|.......|.......|
......|.|.....|.......|.......|
......|.|.....|.......|.......|
.........-----...-----.........
..................................
.....|......|......|......|......|
.....|......|......|......|......|
.....|......|......|......|......|
.....|......|......|......|......|
..................................
.....|......|......|......|......|
.....|......|......|......|......|
.....|......|......|......|......|
.....|......|......|......|......|
..................................
.......---...---.........---...---.........---.
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
.......---...---.........---...---.........---.
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
....|.|...|.|...|.....|.|...|.|...|.....|.|...|
.......---...---.........---...---.........---.
.-.
|.|
...
|.|
.-.
.--.
|..|
|..|
....
|..|
|..|
.--.
.---.
|...|
|...|
|...|
.....
|...|
|...|
|...|
.---.
.--------....................................--------.
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.........|..........|.|........|..........|.|.........
.--------..............--------..............--------.
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.........|..........|..........|..........|..........|
.--------....................................--------.
.--...--...--.
|..|.|..|....|
|..|.|..|....|
..............
|..|.|..|....|
|..|.|..|....|
.--...--......
Code: Select all
your output:
3 0
*---
|***|
|***|
|***|
****
|***|
|***|
|***|
*---
my output:
3 0
*---*
|***|
|***|
|***|
*****
|***|
|***|
|***|
*---*
check out the last asteriks, u cant just keep it empty , u have to fill the whole size with space or either '|' or '-'
i hope u will pass PE this time......and u know how to modify ur code....
Goodluck :wink:
Code: Select all
//Wrong answer
#include<stdio.h>
#include<math.h>
char a[10][5][3]=
{
//ZERO
' ','-',' ',
'|',' ','|',
' ',' ',' ',
'|',' ','|',
' ','-',' ',
//ONE
' ',' ',' ',
' ',' ','|',
' ',' ',' ',
' ',' ','|',
' ',' ',' ',
//TWO
' ','-',' ',
' ',' ','|',
' ','-',' ',
'|',' ',' ',
' ','-',' ',
//THREE
' ','-',' ',
' ',' ','|',
' ','-',' ',
' ',' ','|',
' ','-',' ',
//FOUR
' ',' ',' ',
'|',' ','|',
' ','-',' ',
' ',' ','|',
' ',' ',' ',
//FIVE
' ','-',' ',
'|',' ',' ',
' ','-',' ',
' ',' ','|',
' ','-',' ',
//SIX
' ','-',' ',
'|',' ',' ',
' ','-',' ',
'|',' ','|',
' ','-',' ',
//SEVEN
' ','-',' ',
' ',' ','|',
' ',' ',' ',
' ',' ','|',
' ',' ',' ',
//EIGHT
' ','-',' ',
'|',' ','|',
' ','-',' ',
'|',' ','|',
' ','-',' ',
//NINE
' ','-',' ',
'|',' ','|',
' ','-',' ',
' ',' ','|',
' ','-',' ',
};
int main()
{
// freopen("706.in","r",stdin);
// freopen("706.txt","w",stdout);
int s, n;
int backup,digitCount,i,j;
int process;
int power;
int k,l,x;
int Count=0;
int flag=0;
int flag2=0;
int linef=0;
while( (scanf("%d%d",&s,&n)==2)&&(s||n))
{
if(flag2)
printf("\n");
flag2=1;
backup = n;
digitCount = (int)floor(log10(n))+1;
for(i=0; i<5; )
{
flag=0;
for(j=digitCount-1; j>=0; j--)
{
if(flag)
printf(" ");
flag=1;
power = (int)pow(10,j);
process = n/power;
n = n%power;
int minus=0;
int line=0;
for(x=0; x<3; x++)
{
if(a[process][i][x]=='-')
{
minus=1;
break;
}
if(a[process][i][x]=='|')
{
line=1;
break;
}
}
if(minus)
{
minus=0;
for(k=0; k<3; k++)
{
if(a[process][i][k]=='-'||(a[process][i][k]==' '&&k==1))
{
for(l=0; l<s; l++)
{
printf("%c",a[process][i][k]);
}
}
else
{
printf("%c",a[process][i][k]);
}
}
}
else if(line)
{
linef =1;
if(Count<s)
{
line=0;
for(k=0; k<3; k++)
{
if(a[process][i][k]=='|')
{
printf("%c",a[process][i][k]);
}
else
{
if(a[process][i][k]==' '&&k==1)
{
for(l=0; l<s; l++)
{
printf("%c",a[process][i][k]);
}
}
else
{
printf("%c",a[process][i][k]);
}
}
}
}
}
else
{
for(k=0; k<3; k++)
{
if(a[process][i][k]==' '&&k==1)
{
for(l=0; l<s; l++)
{
printf("%c",a[process][i][k]);
}
}
else
{
printf("%c",a[process][i][k]);
}
}
}
if(Count==s)Count=0;
}
printf("\n");
if(linef)
{
Count++;
linef=0;
}
n = backup;
if(Count==s)Count=0;
if(Count==0){i++;}
}
}
return 0;
}