706 - LCD Display

All about problems in Volume 7. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

HyperAmazing
New poster
Posts: 1
Joined: Mon Jul 19, 2010 6:22 am

Re: 706 - LC-Display(presentation error)

Post by HyperAmazing »

mustak wrote:

Code: Select all

#include<iostream>
#include<cstring>

using namespace std;

int main()
{
 long s,i,j,k,l,f;
 f=0;
 char n[10];   
 freopen("out.txt","w",stdout);
 while(1)
 {   
  cin>>s;
  cin>>n;
  
  if(s==0&&n[0]=='0')
  break;
  
  k=strlen(n);
  for(i=1;i<=2*s+3;i++)
  {
   for(l=0;l<k;l++)
   {
   if(n[l]=='1')
   {                                            
   for(j=1;j<=s+2;j++)
   {
    if(j==s+2)
    {
      if((i!=1)&&(i!=2*s+3)&&(i!=s+2))        
      cout<<"|";
      else
      cout<<" ";         
    }
    else
    cout<<" ";                   
   }
   }
   else if(n[l]=='2')
   {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==1))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='3')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='4')
  {
   for(j=1;j<=s+2;j++)
   {
     if(i==s+2)
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='5')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='6')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==1))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='7')
  {
   for(j=1;j<=s+2;j++)
   {
     if(i==1)
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='8')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==1))
      cout<<"|";
      else if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='9')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==s+2)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
  }
  else if(n[l]=='0')
  {
   for(j=1;j<=s+2;j++)
   {
     if((i==1)||(i==2*s+3))
     {
      if((j!=1)&&(j!=s+2))
      cout<<"-";
      else
      cout<<" ";                                
     }
     else
     {
      if((i!=1)&&(i<s+2)&&(j==s+2))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==1))
      cout<<"|";
      else if((i!=1)&&(i<s+2)&&(j==1))
      cout<<"|";
      else if((i>s+2)&&(i!=2*s+3)&&(j==s+2))
      cout<<"|";
      else
      cout<<" ";    
     }                    
   }
   }
   if(l!=k-1)
   cout<<" ";
  }
   
   cout<<endl;                   
  }   
  cout<<endl;
 }  
 return 0;    
}
I got presentation error on that problem. Please help me.

Code: Select all

2 12345
2 56897
0 0
When I input "2 12345"+enter ,I saw the 12345 has been output already.
In fact,12345 and 56897 should be output at the same time.

Good luck. :D
qweasdf_123
New poster
Posts: 2
Joined: Sun Nov 28, 2010 11:03 am

Re: 706 - LC-Display

Post by qweasdf_123 »

Hello,can any one help me.It seems all righ,but i always get WA.Here is my output.I'am sure everything is correct.
.... .--. .--. .... .--.
...| ...| ...| |..| |...
...| ...| ...| |..| |...
.... .--. .--. .--. .--.
...| |... ...| ...| ...|
...| |... ...| ...| ...|
.... .--. .--. .... .--.

.---. .---. .---. .---. .---.
|.... ....| |...| |...| |...|
|.... ....| |...| |...| |...|
|.... ....| |...| |...| |...|
.---. ..... .---. .---. .....
|...| ....| |...| ....| |...|
|...| ....| |...| ....| |...|
|...| ....| |...| ....| |...|
.---. ..... .---. .---. .---.
pqv
New poster
Posts: 1
Joined: Fri Dec 31, 2010 5:55 pm

Re: 706 - LC-Display

Post by pqv »

I give up! and I salute those who got accepted by the judge!

Don't know what more to do.

Can I assume that each input line consist of 2 numbers? Or do I need to worry about inputs like

Code: Select all

1 234
1 
3 456
0 0
Can I assume that the input are within the range specified 0 - 10 for first number and 0 - 99 999 999 for the second number? Or do I need to worry about boundary checks, and if I need how should too big numbers be handled? cutoff at limit, don't print anything?

How should this input case be handled? (x is a number)

Code: Select all

0 x
Should I terminate or process it as normal? By normal I mean print out an empty 2 columns 3 rows filled with blanks for each digit in x and 1 column of blanks between each digit.
I choosed to process as normal.

How is the input formatted? Do I need to worry about delimeters, white spaces?
Examples.

12345678
12, 345, 678
12. 345. 678
12 345 678
According to specification the format is 99, 999, 999 but in the sample input they write like

Code: Select all

2 12345
3 67890
0 0
I am confused!!

A sample input for my program

Code: Select all

1 123456
2 7890
3 009
0 0
output

Code: Select all

.....-...-.......-...-.
..|...|...|.|.|.|...|..
.....-...-...-...-...-.
..|.|.....|...|...|.|.|
.....-...-.......-...-.

.--...--...--...--.
...|.|..|.|..|.|..|
...|.|..|.|..|.|..|
......--...--......
...|.|..|....|.|..|
...|.|..|....|.|..|
......--...--...--.

.---...---...---.
|...|.|...|.|...|
|...|.|...|.|...|
|...|.|...|.|...|
.............---.
|...|.|...|.....|
|...|.|...|.....|
|...|.|...|.....|
.---...---...---.
I use Java and '|' '-' ' ', I have replaced ' ' with '.' here for better vision.

Have i missed something? I give up!
jfvs
New poster
Posts: 12
Joined: Wed Feb 02, 2011 10:40 am

Re: 706 - LC-Display

Post by jfvs »

hi everyone

I dont know if you already solved your problem with this WA... as a tip to solve it, check carefully your condition to make your program stop, maybe you're not prossessing the whole input (that was my problem)

Also, for those claiming that you dont need a extra space after the last test case... thats surely wrong, I got PE without that extra space

Hope this helps
5442632
New poster
Posts: 1
Joined: Sun Aug 07, 2011 12:39 pm

Re: 706 - LC-Display

Post by 5442632 »

I have thought hard to deal with the WA

but it's still not working

can somebody tell we where I did wrong and send email to c871111116@hotmail.com to me?

please

Code: Select all

#include<iostream>
#include<cstring>
using namespace std;
class LC{
    private:

    char **display;

    int len;//cal the length of n

    int perone;

    int high,width;

    int *num;

    void count_digit(int n){
        len=1;
        while(1){
            n=n/10;
            if(n==0){
                break;
            }
            len++;
        }
    }

    void copy_into_array(int n){
        for(int i=len-1;i>=0;i--){
            num[i]=n%10;
            n=n/10;
        }
    }
    //below,a is the start position (width*width)
    void zero(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a]='|';
            display[perone+1+i][a]='|';
            display[high-1][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }

    }

    void one(int a){
        for(int i=1;i<=perone;i++){
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void two(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[perone+1][a+i]='-';
            display[perone+1+i][a]='|';
            display[high-1][a+i]='-';
            display[i][a+perone+1]='|';
        }
    }

    void three(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[perone+1][a+i]='-';
            display[high-1][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void four(int a){
        for(int i=1;i<=perone;i++){
            display[i][a]='|';
            display[perone+1][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void five(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a]='|';
            display[perone+1][a+i]='-';
            display[high-1][a+i]='-';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void six(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a]='|';
            display[perone+1][a+i]='-';
            display[perone+1+i][a]='|';
            display[high-1][a+i]='-';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void seven(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void eight(int a){
        for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a]='|';
            display[perone+1][a+i]='-';
            display[perone+1+i][a]='|';
            display[high-1][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    void nine(int a){
    for(int i=1;i<=perone;i++){
            display[0][a+i]='-';
            display[i][a]='|';
            display[perone+1][a+i]='-';
            display[high-1][a+i]='-';
            display[i][a+perone+1]='|';
            display[perone+1+i][a+perone+1]='|';
        }
    }

    public:

    LC(int m,int n){
        high=2*m+3;
        count_digit(n);
        width=len*(m+2);
        perone=m;
        display=new char*[high];
        for(int i=0;i<high;i++){
            display[i]=new char[width];
        }
        for(int i=0;i<high;i++){
            for(int j=0;j<width;j++){
                display[i][j]=' ';
            }
        }
        num=new int[len];
        copy_into_array(n);
    }

    ~LC(){
        for(int i=0;i<high;i++){
            delete []display[i];
        }
        delete []display;
        delete []num;
    }

    void put(){
        int k=0;
        for(int i=0;i<width;){
            if(num[k]==0){
                zero(i);
            }
            else if(num[k]==1){
                one(i);
            }
            else if(num[k]==2){
                two(i);
            }
            else if(num[k]==3){
                three(i);
            }
            else if(num[k]==4){
                four(i);
            }
            else if(num[k]==5){
                five(i);
            }
            else if(num[k]==6){
                six(i);
            }
            else if(num[k]==7){
                seven(i);
            }
            else if(num[k]==8){
                eight(i);
            }
            else{
                nine(i);
            }
            k=k+1;
            i=i+perone+2;
        }
    }

    void show(){
        for(int i=0;i<high;i++){
            for(int j=0;j<width;j++){
                cout<<display[i][j];
            }
            cout<<endl;
        }
    }
};

int main(){
   int a,b;
   while(cin>>a>>b){
       if(a==0 && b==0){
           break;
       }
       if(a==0 || a>10 || b>99999999 || a<1 || b<0){
           continue;
       }
       LC output(a,b);
       output.put();//put every number in LC way
       output.show();
   }
}
SeyedParsa
New poster
Posts: 2
Joined: Sat Nov 26, 2011 8:15 pm

Please help!

Post by SeyedParsa »

Removed after AC
gjbenny
New poster
Posts: 2
Joined: Sun Mar 18, 2012 8:31 am

"cout" cause "Runtime Error"

Post by gjbenny »

I have tried many times, but I still got RE. Who can tell me why? I test my code and it seems that "cout" in "print" function casuse the problem. I tried to delete some "cout" in the function and I got WA. Need for HELP!! :roll:

Here is my code:

Code: Select all

#include<iostream>
#include<cstdlib>
using namespace std;

void print(int i , int j , int size , int n[] , int c);

bool test(int num , int part);

int main()
{
    int size ;

    while(cin>>size&&size)
    {
        int n[8] , c=0 ;
        char a ;

        cin.get(a);

        while(cin.get(a)&&(a!='\n'))
        {
            n[c]=a-48;

            c++;
        }

        for(int i=1;i<=(2*size+3);i++)
        {
            for(int j=0;j<c;j++)
            {
                print(i , j , size , n , c);

                if(j<c-1)cout<<" ";
            }

            cout<<endl;
        }

        cout<<endl;
    }

    return 0;
}

void print(int i , int j , int size , int n[] , int c)
{
    if(i==1)
    {
        cout<<" ";

        if(test(n[j] , 1))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
    else if(i<(size+2))
    {
        if(test(n[j] , 2))cout<<"|";
        else cout<<" ";

        for(int i=1;i<=size;i++)cout<<" ";

        if(test(n[j] , 3))cout<<"|";
        else cout<<" ";
    }
    else if(i==(size+2))
    {
        cout<<" ";

        if(test(n[j] , 4))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
    else if(i<(2*size+3))
    {
        if(test(n[j] , 5))cout<<"|";
        else cout<<" ";

        for(int i=1;i<=size;i++)cout<<" ";

        if(test(n[j] , 6))cout<<"|";
        else cout<<" ";
    }
    else
    {
        cout<<" ";

        if(test(n[j] , 7))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
}

bool test(int num , int part)
{
    switch(num)
    {
        case 0:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 1:
            switch(part)
            {
                case 1:
                    return 0;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 2:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 0;
                case 7:
                    return 1;
            }
        case 3:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 4:
            switch(part)
            {
                case 1:
                    return 0;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 5:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 0;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 6:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 0;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 7:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 8:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 9:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
    }

    exit(1);
}
gjbenny
New poster
Posts: 2
Joined: Sun Mar 18, 2012 8:31 am

Re: 706 - LC-Display

Post by gjbenny »

I found my problem is not just caused by "cout". I changed the way to get the input, and it became AC. Who can tell me why?

Here is my code:

Code: Select all

#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;

void print(int i , int j , int size , string n , int c);

bool test(int num , int part);

int main()
{
    int size ;

    while(cin>>size&&size)
    {
        int c ;

        string n;

        cin>>n;

        for(int i=0;i<n.length();i++)
        {
            n[i]-=48;
        }

        c=n.length();

        for(int i=1;i<=(2*size+3);i++)
        {
            for(int j=0;j<c;j++)
            {
                print(i , j , size , n , c);

                if(j<c-1)cout<<" ";
            }

            cout<<endl;
        }

        cout<<endl;
    }

    return 0;
}

void print(int i , int j , int size , string n , int c)
{
    if(i==1)
    {
        cout<<" ";

        if(test(n[j] , 1))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
    else if(i<(size+2))
    {
        if(test(n[j] , 2))cout<<"|";
        else cout<<" ";

        for(int i=1;i<=size;i++)cout<<" ";

        if(test(n[j] , 3))cout<<"|";
        else cout<<" ";
    }
    else if(i==(size+2))
    {
        cout<<" ";

        if(test(n[j] , 4))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
    else if(i<(2*size+3))
    {
        if(test(n[j] , 5))cout<<"|";
        else cout<<" ";

        for(int i=1;i<=size;i++)cout<<" ";

        if(test(n[j] , 6))cout<<"|";
        else cout<<" ";
    }
    else
    {
        cout<<" ";

        if(test(n[j] , 7))
        {
            for(int i=1;i<=size;i++)
            {
                cout<<"-";
            }
        }
        else
        {
            for(int i=1;i<=size;i++)
            {
                cout<<" ";
            }
        }

        cout<<" ";
    }
}

bool test(int num , int part)
{
    switch(num)
    {
        case 0:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 1:
            switch(part)
            {
                case 1:
                    return 0;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 2:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 0;
                case 7:
                    return 1;
            }
        case 3:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 4:
            switch(part)
            {
                case 1:
                    return 0;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 5:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 0;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 6:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 0;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 7:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 0;
                case 3:
                    return 1;
                case 4:
                    return 0;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 0;
            }
        case 8:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 1;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
        case 9:
            switch(part)
            {
                case 1:
                    return 1;
                case 2:
                    return 1;
                case 3:
                    return 1;
                case 4:
                    return 1;
                case 5:
                    return 0;
                case 6:
                    return 1;
                case 7:
                    return 1;
            }
    }

    exit(1);
}
Fedaykin
New poster
Posts: 6
Joined: Sun Dec 09, 2012 9:27 pm

Re: Solved!

Post by Fedaykin »

fabiofabris wrote:I finally made it!!!

Some considerations about this problem:
- X 0001 should print 1
- X 0000 should print 0
that you are printing a blank column BETWEEN digits.

I think this input is kinnda trick...
This helped me to get ac
chipchip3412
New poster
Posts: 7
Joined: Mon Jun 10, 2013 2:14 pm

Re: 706 - LC-Display

Post by chipchip3412 »

Anybody help? I've tried the problems many times but still get Wrong Answer.
Can anybody take a look at my code? I've tried many tests and can't see anything wrong

Code: Select all


//Deleted

Last edited by chipchip3412 on Wed Jun 12, 2013 11:47 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 706 - LC-Display

Post by brianfry713 »

Output a blank line after each number, including the last one.
Check input and AC output for thousands of problems on uDebug!
chipchip3412
New poster
Posts: 7
Joined: Mon Jun 10, 2013 2:14 pm

Re: 706 - LC-Display

Post by chipchip3412 »

brianfry713 wrote:Output a blank line after each number, including the last one.
Oh, thank you, but I've tried output 1 blank line after the last number too, but it's still WA
I just can't understand :(

Here's my new code, edited as you said

Code: Select all

// Deleted
Last edited by chipchip3412 on Wed Jun 12, 2013 11:47 am, edited 2 times in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 706 - LC-Display

Post by brianfry713 »

Maybe there is extra whitespace in the input, like:

Code: Select all

2  12345
3 67890
0 0
Check input and AC output for thousands of problems on uDebug!
chipchip3412
New poster
Posts: 7
Joined: Mon Jun 10, 2013 2:14 pm

Re: 706 - LC-Display

Post by chipchip3412 »

Oh! Thank you very much brianfry. I've got AC now.
That one is really tricky :lol:
catalan
New poster
Posts: 4
Joined: Sun Jun 16, 2013 8:25 pm

Re: 706 - LC-Display

Post by catalan »

Hello - After hours of labour, I found my mistake and finally got my code accepted. Here is a list of things you all should remember.

1) Print a blank between each digit. This does not necessarily mean a white space.
2) Do not print a blank line before the first test case.
3) Print a blank line between test cases and after the last test case.
4) Do not print whitespaces after each line.
5) The test case x 002 shoud be printed 002 only.
6) And finally the digit 9 (with size 2) should be printed as

Code: Select all

 --                 and not         --
|  |                               |   |
|  |                               |   |
 --                                  --
   |                                   |
   |                                   |
 --
Notice the difference.

Rectifying these points should get your code accepted. Hope this helps.
Post Reply

Return to “Volume 7 (700-799)”