Contract revision_11830

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

Moderator: Board moderators

Contract revision_11830

Postby sms.islam » Sat Sep 25, 2010 6:17 pm

i got wa several times. my input output is given below....................please give me some critical input and output.

5 5000000
3 123456
9 23454324543423
9 99999999991999999
7 777
1 1000002
1 10000203
5 5000000000000000000000000000000000000041
5 1051
........................................................
0
12456
23454324543423
1
2
203
41
101
[c]
please....................
sms.islam
New poster
 
Posts: 19
Joined: Sat Oct 10, 2009 10:28 am

Re: Contract revision_11830

Postby pdwd » Sun Sep 26, 2010 2:46 am

You don't have answer for 7 777 in your output.
pdwd
New poster
 
Posts: 19
Joined: Sat May 15, 2010 4:35 pm

Re: Contract revision_11830

Postby sms.islam » Mon Sep 27, 2010 2:31 pm

[]
point taken.i missed it.It will be

7 777------------>1

now please help me through it
[]
sms.islam
New poster
 
Posts: 19
Joined: Sat Oct 10, 2009 10:28 am

Re: Contract revision_11830

Postby pdwd » Tue Sep 28, 2010 3:21 am

7 777 should be 0
pdwd
New poster
 
Posts: 19
Joined: Sat May 15, 2010 4:35 pm

Re: Contract revision_11830

Postby Shafaet_du » Tue Sep 28, 2010 7:42 pm

some I/O:

Code: Select all
2 100002000003
5 10000005000004000500
6 000061256
7 343447003437
8 034803434
9 90000000009
1 11111111
8 4545238123128234
5 505050505050505
5 101010101010101
5 105050505010
0 0

output:

Code: Select all
10000000003
100000000000400000
125
3434400343
3403434
0
0
45452312312234
0
101010101010101
10000010


very easy problem. just handle leading zeroes carefully. should be ac in less than 10 minutes :).
Shafaet_du
Experienced poster
 
Posts: 147
Joined: Mon Jun 07, 2010 11:43 am
Location: University Of Dhaka,Bangladesh

Re: Contract revision_11830

Postby sms.islam » Wed Sep 29, 2010 4:52 pm

Thanks.............finally i got AC...........thats a great feelings isn't it?
sms.islam
New poster
 
Posts: 19
Joined: Sat Oct 10, 2009 10:28 am

Re: Contract revision_11830

Postby naseef_07cuet » Wed Dec 01, 2010 12:55 pm

It is a very simple problem.. Happy coding:)
If you have determination, you can do anything you want....:)
naseef_07cuet
Learning poster
 
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: Contract revision_11830

Postby plamplam » Sun Jun 19, 2011 7:55 am

Some test cases
Code: Select all
1 91029120
3 9192013010391
5 000005555101020
5 5555555550555551555555655554


Code: Select all
902920
91920101091
101020
164
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson
User avatar
plamplam
Experienced poster
 
Posts: 151
Joined: Fri May 06, 2011 11:37 am

Re: Contract revision_11830

Postby sumit saha shawon » Wed Aug 08, 2012 10:23 pm

my all input and output correct but why I am getting wa :oops:
My code:

#include<stdio.h>
#include<string.h>
char ch[1500],ar[1500];
int main()
{
int n;
while(scanf("%d",&n)==1)
{
if(n==0)
break;
scanf("%s",&ch);
int i,a=0;
for(i=0; ch[i]!='\0'; i++)
{
if(ch[i]-'0'!=n)
ar[a++]=ch[i];
}
ar[a]='\0';
if(ar[0]=='0')
{
i=0;
while(ar[i]=='0')
i++;
if(i==a)
{
printf("0\n");

}
else
{
while(ar[i]!='\0')
printf("%c",ar[i++]);
puts("");

}


}
else
{
for(i=0; ar[i]!='\0'; i++)
printf("%c",ar[i]);
puts("");
}



}
return 0;
}
sumit saha shawon
New poster
 
Posts: 19
Joined: Tue Jun 26, 2012 9:19 pm

Re: Contract revision_11830

Postby brianfry713 » Fri Aug 10, 2012 9:02 am

Doesn't match the sample I/O.
brianfry713
Guru
 
Posts: 1742
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA


Return to Volume CXVIII

Who is online

Users browsing this forum: No registered users and 1 guest