Page 2 of 9

Posted: Tue Nov 12, 2002 6:23 am
by zhangl
Can anybody help me with sending the program to me?
My E-mail is ctozlm@163.com.

10101 Why WA!

Posted: Sun Dec 08, 2002 11:52 am
by Taslim
:(
----------INPUT----------
1.0
2.00
3.000
4.01
5.001
6.1000000000
7.100000000000000
----------OUTPUT--------
1. 0
2.
3.
4. 1
5. 1
6. 1 shata kuti
7. 1 kuti kuti

So whats the warng with my program :o [/b]

Whats the wrong with my code? Why WA? Do u know?

Posted: Mon Dec 09, 2002 9:14 am
by Taslim
Whats the wrong with my code? Why WA? Do u know?

#include<stdio.h>
#include<string.h>

void process(char string[])
{
int len,i;
len=strlen(string);
if(len==7)
{
if(string[0]=='0')
{
if(string[1]!='0')
printf("%c lakh ",string[1]);
}
else
printf("%c%c lakh ",string[0],string[1]);
if(string[2]=='0')
{
if(string[3]!='0')
printf("%c hajar ",string[3]);
}
else
printf("%c%c hajar ",string[2],string[3]);
if(string[4]=='0');
else
printf("%c shata ",string[4]);
if(string[5]=='0')
{
if(string[6]!='0')
printf("%c",string[6]);
}
else
printf("%c%c",string[5],string[6]);
return;
}

if(len==6)
{
if(string[0]=='0');
else
printf("%c lakh ",string[0]);
if(string[1]=='0')
{
if(string[2]!='0')
printf("%c hajar ",string[2]);
}
else
printf("%c%c hajar ",string[1],string[2]);
if(string[3]=='0');
else
printf("%c shata ",string[3]);
if(string[4]=='0')
{
if(string[5]!='0')
printf("%c",string[5]);
}
else
printf("%c%c",string[4],string[5]);
return;
}

if(len==5)
{
if(string[0]=='0')
{
if(string[1]!='0')
printf("%c hajar ",string[1]);
}
else
printf("%c%c hajar ",string[0],string[1]);
if(string[2]=='0');
else
printf("%c shata ",string[2]);
if(string[3]=='0')
{
if(string[4]!='0')
printf("%c",string[4]);
}
else
printf("%c%c",string[3],string[4]);
return;
}

if(len==4)
{
if(string[0]=='0');
else
printf("%c hajar ",string[0]);
if(string[1]=='0');
else
printf("%c shata ",string[1]);
if(string[2]=='0')
{
if(string[3]!='0')
printf("%c",string[3]);
}
else
printf("%c%c",string[2],string[3]);
return;
}
if(len==3)
{
if(string[0]=='0');
else
printf("%c shata ",string[0]);
if(string[1]=='0')
{
if(string[2]!='0')
printf("%c",string[2]);
}
else
printf("%c%c",string[1],string[2]);
return;
}
if(len==2)
{
if(string[0]=='0')
{
if(string[1]!='0')

printf("%c",string[1]);
}
else
printf("%c%c",string[0],string[1]);
return;
}
if(len==1)
{
if(string[0]=='0');
else
printf("%c",string[0]);
return;
}
}

void main()
{
char input[16],sub1[8],sub2[8];
int flag,len,i,temp,j;
long double count=0;
while(scanf("%s",input)!=EOF)
{
flag=0;

j=0;
count++;
printf("%.Lf. ",count);
len=strlen(input);
i=0;
if(len==1&& input[0]=='0')
printf("%c",input[0]);
if(len>14)
{
flag=1;
for(i=0;i<7;i++)
sub1=input[i+1];
sub1='\0';
temp=8;
for(i=0;i<7;i++)
{sub2=input[temp];temp++;}
sub2='\0';
}

if(len>7&&len<=14)
{
flag=2;
temp=len;
for(i=7;i>=0;i--)
{sub1=input[temp];temp--;}
sub1[8]='\0';
for(i=len-8;i>=0;i--)
{sub2=input[temp];temp--;}
sub2[len-7]='\0';
}
if(len<=7&&len!=0)
{flag=3;
for(i=0;i<len;i++)
sub1=input;
sub1='\0';}
if(flag==1)
{
printf("%c kuti ",input[0]);
process(sub1);
printf(" kuti ");
process(sub2);
}
if(flag==2)
{
process(sub2);
printf(" kuti ");
process(sub1);
}
if(flag==3)
process(sub1);
printf("\n");
}
}


[/cpp]

Posted: Mon Dec 09, 2002 1:13 pm
by Dominik Michniewski
Why in case 2 and 3 you don't write output ?

Dominik

Posted: Mon Dec 09, 2002 2:20 pm
by Taslim
Thanks for replay.......for case 2 my program print also...there was not the problem...I got AC :D but still Presentation Error.... :-? i am not geting whats the wrong in my out put....Thanks all.... :lol:

I can

Posted: Mon Dec 09, 2002 5:42 pm
by Rajib Mazumder
Contact me by my email address. I can help :D with that problem....Rajib Mazumder

Output for 0, 00, 000..

Posted: Fri Feb 21, 2003 3:19 pm
by Whinii F.
I just got AC and output for

0, 00, 000, and 0000 ... are all just 0.
No need to check about that

Posted: Wed Apr 09, 2003 9:38 pm
by turuthok
Ugh, I thought that the problem description explicitly says the input will be a positive number ... Got tripped on that ... :(

-turuthok-

10101

Posted: Wed Sep 17, 2003 12:19 am
by bugzpodder
could someone explain the rules behind Bangla Numbers? the question is quiet vague

Thank you

Bugz

Posted: Wed Sep 17, 2003 8:26 am
by anupam
parse the input with several if else. bugz

Posted: Wed Sep 17, 2003 8:44 am
by Dominik Michniewski
Think about dividing input numbers into parts of three digits ...

Best regards
DM

Posted: Wed Sep 17, 2003 4:03 pm
by Joseph Kurniawan
just use hardcode!!
It's quite hard without hardcoding since contants are involved (shata, kuti, hajar, etc.).
I used 15 cases to solve this prob and got AC in first attempt. It's not a hard prob actually, but you have to be careful with the input!! :wink: :wink:

Posted: Wed Sep 17, 2003 11:01 pm
by bugzpodder
but what are the rules? what happens when its 1 kuti 1 lakh 0 hajar 1 shata

do i go: 1 kuti lakh shata?
or 1 kuti 1 lakh 1 shata?

what happens if its over 1 shata 1 khuti (10^10)? do i output 1 shata khuti?

do i treat this like english language? one hundred million and stuff?

Posted: Thu Sep 18, 2003 6:45 am
by Joseph Kurniawan
1 kuti 1 lakh 0 hajar 1 shata = 1 kuti 1 lakh 1 shata
10^10 = 1 shata kuti
Hope this helps!! :wink: :wink: :wink:

Posted: Thu Sep 18, 2003 9:08 am
by Dominik Michniewski
It's not very hard to solve this problem without hardcoding :-)
I made it first time :-)
The clue is proper dividing number to part of three digits and use additional table with names of numbers (shata, kuti a.s.o.) ...

Best regards
DM