Page 7 of 9
Re: 10101 - Bangla Numbers
Posted: Mon Mar 16, 2009 8:57 am
by mf
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.
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)
Re: 10101 - Bangla Numbers
Posted: Mon Mar 16, 2009 9:19 am
by Obaida
Thank you mf. You taught me a good lesson. I really need such Suggestions.
Now i need some test case to avoid WA.

Re: 10101 - Bangla Numbers
Posted: Sat Mar 28, 2009 4:13 am
by f(_irt
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

Re: 10101 - Bangla Numbers
Posted: Thu Jun 25, 2009 8:29 am
by lnr
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?
Re: 10101 - Bangla Numbers
Posted: Thu Jun 25, 2009 9:23 am
by lnr
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?
Re: 10101 - Bangla Numbers
Posted: Thu Jul 02, 2009 8:36 am
by Obaida
I think new line causes wrong answer..
mistake in printing space cause pe..

Re: 10101 - Bangla Numbers
Posted: Wed Jul 08, 2009 3:51 pm
by lnr
Accepted.
Re:
Posted: Mon Dec 14, 2009 8:07 pm
by Rizoan toufiq
.
Re: 10101 - Bangla Numbers
Posted: Fri Jun 25, 2010 8:52 pm
by sami001
WHY MY CODE is taken as WA when it generates all correct answers??
#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;
}
Re: 10101 - Bangla Numbers
Posted: Sun May 06, 2012 1:39 am
by shuza
why PE ??? can't understand.....here is my code
get AC thnx.....
Re: 10101 - Bangla Numbers
Posted: Mon May 07, 2012 11:35 pm
by brianfry713
Use %4d for the case number.
Re: 10101 - Bangla Numbers
Posted: Sat Jul 21, 2012 12:50 pm
by uvasarker
I am getting W A. Why?
Please help me....
Why WA again n again ?? : 10101 - Bangla Numbers
Posted: Sun Jul 22, 2012 9:25 pm
by sonjbond
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
Re: 10101 - Bangla Numbers
Posted: Tue Jul 24, 2012 12:09 am
by brianfry713
Try an input of 0.
Re: 10101 - Bangla Numbers
Posted: Fri Jul 27, 2012 8:41 pm
by sonjbond