10101 - Bangla Numbers

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

Moderator: Board moderators

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Re: 10101 - Bangla Numbers

Post by mf » Mon Mar 16, 2009 8:57 am

Obaida wrote:Some one please help me i am getting CE constantly...
My compiler prints "error: integer constant is too large for ‘long’ type", for every large integer in your code.
Consider appending LL suffix to each of them, so that the compiler will treat them as 64-bit integers.
E.g. write 100000000000000LL instead of 100000000000000.
I spent so many time on it... But got CE again and again. :oops: :oops: :oops:
There's a very easy way for you to avoid CEs - install and use gcc compiler to compile your program, like the judge does.
Most Linux distributions include gcc by default, so you may also want to install one of them, too.
If you need to use Windows, try Cygwin, or Mingw (ports of gcc to windows)

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 10101 - Bangla Numbers

Post by Obaida » Mon Mar 16, 2009 9:19 am

Thank you mf. You taught me a good lesson. I really need such Suggestions.
Now i need some test case to avoid WA. :)
try_try_try_try_&&&_try@try.com
This may be the address of success.

f(_irt
New poster
Posts: 1
Joined: Sat Mar 28, 2009 4:09 am

Re: 10101 - Bangla Numbers

Post by f(_irt » Sat Mar 28, 2009 4:13 am

i don't know why i am getting WA......
Is thr any problem with a null after each input.....
plzz reply...
this is my code---

Code: Select all

//10101 bangla numbers
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;

static long long int kuti = 10000000;
static long long int lakh = 100000;
static long long int hazar = 1000;
static long long int shata = 100;
string s;
//vector<string>vs;

string give_no(long long int m)
{      string sm;
            if(m/10==1)sm="1";
       else if(m/10==2)sm="2";
       else if(m/10==3)sm="3";
       else if(m/10==4)sm="4";
       else if(m/10==5)sm="5";
       else if(m/10==6)sm="6";
       else if(m/10==7)sm="7";
       else if(m/10==8)sm="8";
       else if(m/10==9)sm="9";
       
            if(m%10==0)sm+="0 ";
       else if(m%10==1)sm+="1 ";
       else if(m%10==2)sm+="2 ";       
       else if(m%10==3)sm+="3 ";
       else if(m%10==4)sm+="4 ";
       else if(m%10==5)sm+="5 ";
       else if(m%10==6)sm+="6 ";
       else if(m%10==7)sm+="7 ";
       else if(m%10==8)sm+="8 ";
       else if(m%10==9)sm+="9 ";
       
       return sm;
       }


string give_result(string s,long long int n)
{      
      long long int loc=n/kuti;
       
        if(loc==0);//return 0 and break
        else{
             s+=give_result(s,loc);
             s+="kuti ";   
             
             }
         n=n%kuti;    
        long long int k,l,h,sh;
         l = n/lakh;
         if(l!=0){
         s+=give_no(l);               
         s+="lakh ";}
         
         h = (n%lakh)/hazar;
         if(h!=0){
         s+=give_no(h);
         s+="hazar ";
         }
         sh = (n%hazar)/shata;
         if(sh!=0)
         {s+=give_no(sh);
          s+="shata ";
                  }
         k=n%shata;
          if(k!=0)
          s+=give_no(k);         
         
       return s;
       }
       

int main()
{
    long long int n;
    int count=0;
    while(cin>>n){ count++;
                   s="";
                   if(n!=0)
                   s = give_result(s,n);
                   else
                   s = "0"; 
                   cout.width(4);
                   cout<<count<<". "<<s<<endl;
                  
                  
                  
                  }
    
    
    
    system("pause");
    return 0;
    }

plz help :oops:
satisfaction is end of life..............

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 10101 - Bangla Numbers

Post by lnr » Thu Jun 25, 2009 8:29 am

Can anyone give some special input output?

I tested these.
Are they correct?
input:

Code: Select all

999999999999999
101010101010101
010101010101010
100000000000001 
100000000000
output:

Code: Select all

   1. 9 kuti 99 lakh 99 hajar 9 shata 99 kuti 99 lakh 99 hajar 9 shata 99  
   2. 1 kuti 1 lakh 1 hajar 10 kuti 10 lakh 10 hajar 1 shata 1  
   3. 10 lakh 10 hajar 1 shata 1 kuti 1 lakh 1 hajar 10  
   4. 1 kuti kuti 1  
   5. 10 hajar kuti 
Is it correct?

Code: Select all

 printf("%4d. ", cs++);

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 10101 - Bangla Numbers

Post by lnr » Thu Jun 25, 2009 9:23 am

Now getting presentation error.
Is there any newline after the last line of output?
And at the end of a line can a space character cause presentation error?

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 10101 - Bangla Numbers

Post by Obaida » Thu Jul 02, 2009 8:36 am

I think new line causes wrong answer..
mistake in printing space cause pe.. :)
try_try_try_try_&&&_try@try.com
This may be the address of success.

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 10101 - Bangla Numbers

Post by lnr » Wed Jul 08, 2009 3:51 pm

Accepted.

Rizoan toufiq
New poster
Posts: 4
Joined: Mon Apr 21, 2008 9:38 pm

Re:

Post by Rizoan toufiq » Mon Dec 14, 2009 8:07 pm

.
Last edited by Rizoan toufiq on Tue Sep 29, 2015 6:29 pm, edited 2 times in total.

sami001
New poster
Posts: 3
Joined: Thu Jun 17, 2010 5:19 pm

Re: 10101 - Bangla Numbers

Post by sami001 » Fri Jun 25, 2010 8:52 pm

WHY MY CODE is taken as WA when it generates all correct answers?? :cry:

#include <stdio.h>

int main()
{
int l,k[16],j;
unsigned long long i,p,a,b,c,x,y,z;

while(scanf("%llu",&i)==1)
{
l=0;

p=i;

for(j=0;j<15;j++)
{
k[j]=i%10;
l++;
i/=10;
if(i==0)break;
}

a=p-(p%100000);
b=p-(p%1000);
c=p-(p%100);
x=p-(p%1000000000000);
y=p-(p%10000000000);
z=p-(p%1000000000);

for(j=l-1;j>=0;j--)
{
if((j==13 && k[13]==0)||(j==12 && k[13]==0 && k[12]==0))continue;
else if((j==11 && k[11]==0)||(j==10 && k[11]==0 && k[10]==0))continue;
else if((j==9 && k[9]==0)||(j==8 && k[8]==0))continue;
else if((j==7 && k[8]==0 && k[7]==0)){printf("kuti ");continue;}
else if((j==6 && k[6]==0)||(j==5 && (k[6]==0 && k[5]==0)))continue;
else if((j==4 && k[4]==0)||(j==3 && k[4]==0 && k[3]==0))continue;
else if((j==2 && k[2]==0)||(j==1 && k[1]==0)||(j==0 && k[1]==0 && k[0]==0))continue;

printf("%d",k[j]);
if(l==15 && j==14)printf(" kuti ");
if(l>12 && j==12 && x%100000000000000!=0)printf(" lakh ");
if(l>10 && j==10 && y%1000000000000!=0 )printf(" hajar ");
if(l>9 && j==9 && z%100000000000!=0)printf(" shata ");
if(l>7 && j==7)printf(" kuti ");
if(l>5 && j==5 && a%10000000!=0)printf(" lakh ");
if(l>3 && j==3 && b%100000!=0)printf(" hajar ");
if(l>2 && j==2 && c%1000!=0)printf(" shata ");
}
printf("\n");


}

return 0;
}

shuza
New poster
Posts: 4
Joined: Fri May 04, 2012 1:59 am

Re: 10101 - Bangla Numbers

Post by shuza » Sun May 06, 2012 1:39 am

why PE ??? can't understand.....here is my code

get AC thnx.....
Last edited by shuza on Tue May 08, 2012 5:44 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10101 - Bangla Numbers

Post by brianfry713 » Mon May 07, 2012 11:35 pm

Use %4d for the case number.
Check input and AC output for thousands of problems on uDebug!

uvasarker
Learning poster
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh
Contact:

Re: 10101 - Bangla Numbers

Post by uvasarker » Sat Jul 21, 2012 12:50 pm

I am getting W A. Why?
Please help me....

Code: Select all

/* Removed after AC */

sonjbond
New poster
Posts: 19
Joined: Wed Jul 04, 2012 10:30 pm

Why WA again n again ?? : 10101 - Bangla Numbers

Post by sonjbond » Sun Jul 22, 2012 9:25 pm

um getting WA again and again ,,,, heres my code ...... plz help me ..... plz.......
code :

#include<stdio.h>


int main()
{

long long int num;
int i=0;
while(scanf("%lld",&num)==1)
{
long long a,b,c,d,e,f,g,h;
i++;
a=num /100000000000000;
num=num %100000000000000;
b=num/1000000000000;
num=num%1000000000000;
c=num/10000000000;
num=num%10000000000;
d=num/1000000000;
num=num%1000000000;
e=num/10000000;
num=num%10000000;
f=num/100000;
num=num%100000;
g=num/1000;
num=num%1000;
h=num/100;
num=num%100;
printf("%4d.",i);
if(a!=0)
printf(" %lld kuti",a);
if(b!=0)
printf(" %lld lakh", b);
if(c!=0)
printf(" %lld hajar",c);
if(d!=0)
printf(" %lld shata",d);
if(e!=0)
printf(" %lld kuti",e);
else if(e==0&&(a!=0||b!=0||c!=0||d!=0))
printf(" kuti");
if(f!=0)
printf(" %lld lakh", f);
if(g!=0)
printf(" %lld hajar",g);
if(h!=0)
printf(" %lld shata",h);
if(num!=0)
printf(" %lld",num);
printf("\n");

}
return 0;
}


plz reply me where d prob in my code ,,, and give me critical I/O plz

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10101 - Bangla Numbers

Post by brianfry713 » Tue Jul 24, 2012 12:09 am

Try an input of 0.
Check input and AC output for thousands of problems on uDebug!

sonjbond
New poster
Posts: 19
Joined: Wed Jul 04, 2012 10:30 pm

Re: 10101 - Bangla Numbers

Post by sonjbond » Fri Jul 27, 2012 8:41 pm

output is 0 for the input 0 , shouldnt it ?? plz check my code again and help me ........... :( :( :( :(

Post Reply

Return to “Volume 101 (10100-10199)”