11723 - Numbering Roads

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

Moderator: Board moderators

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11723-Numbering Roads!

Post by naseef_07cuet » Wed Dec 01, 2010 1:17 pm

try the case above...
If you have determination, you can do anything you want....:)

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

11723 - Numbering Roads

Post by esharif » Tue Jun 05, 2012 11:54 am

Though I test all cases given by problem setter & from this site's user, but I still get WA. Why????
Here is my code below:

Code: Select all

#include<stdio.h>
int main()
{
	int R, N, n=1, temp, suff;
	while(n>0)
	{
		scanf("%d%d",&R,&N);
		if(R==0 && N==0)
			break;
		temp=R-N;
		if(temp>(26*N))
			printf("Case %d: impossible\n",n++);
		else
		{
			if(temp<=0)
				suff=0;
			else
				suff=(temp/N)+1;
			printf("Case %d: %d\n", n++, suff);
		}
	}
return 0;
}

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

Re: Why WA!! for 11723, help me please...

Post by brianfry713 » Tue Jun 05, 2012 9:06 pm

Input 8 4, output should be 1.
Check input and AC output for thousands of problems on uDebug!

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

Re: Why WA!! for 11723, help me please...

Post by esharif » Wed Jun 13, 2012 8:43 am

brianfry713 wrote:Input 8 4, output should be 1.
Lets see now,

Code: Select all

#include<stdio.h>
int main()
{
   int R, N, n=1, temp, suff;
   while(n>0)
   {
      scanf("%d%d",&R,&N);
      if(R==0 && N==0)
         break;
      temp=R-N;
      if(temp>(26*N))
         printf("Case %d: impossible\n",n++);
      else
      {
			if(temp%N==0)
				suff=temp/N;
			else if(temp%N>0)
				suff=(temp/N)+1;
         printf("Case %d: %d\n", n++, suff);
      }
   }
return 0;
}

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

Finally I got AC for 11723, let see more critical i/p

Post by esharif » Wed Jun 13, 2012 2:26 pm

i/p
900 90
32 8
52 2

o/p
9
3
25

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

Re: Why WA!! for 11723, help me please...

Post by brianfry713 » Wed Jun 13, 2012 11:35 pm

Input 8 9, output should be 0.
Check input and AC output for thousands of problems on uDebug!

Antimatter Towhid
New poster
Posts: 1
Joined: Sun Apr 14, 2013 12:40 am

Re: 11723 - Numbering Roads

Post by Antimatter Towhid » Sat Jun 01, 2013 1:57 pm

Code: Select all

#include<stdio.h>
#include<math.h>

int main()
{
    double R, N;
    int n, i=0, p;
    while(scanf("%lf %lf", &R, &N)==2 &&(R&&N))
    {
        int p=ceil((R-N)/N);
        if(p>26) printf("Case %d: impossible\n", ++i);
        else printf("Case %d: %d\n", ++i, p);
    }
    return 0;
}
why Compilation Error?

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

Re: 11723 - Numbering Roads

Post by brianfry713 » Tue Jun 11, 2013 12:35 am

Click My Submissions to see the reason for your CE
Check input and AC output for thousands of problems on uDebug!

mobarak.islam
New poster
Posts: 38
Joined: Wed Dec 05, 2012 11:29 pm

Re: Why WA!! for 11723, help me please...

Post by mobarak.islam » Fri Jul 19, 2013 9:18 pm

Here I'm getting wa! please help

#include<stdio.h>
#include<stdlib.h>
#include<cstring>
#include<math.h>

int main()
{
int R,D,t=0,res;
float res1;
scanf("%d %d",&R,&D);
while(R)
{
res=0;
t++;
if((R-D)/D > 26)
printf("Case %d: impossible\n",t);
else if(R <= D )
printf("Case %d: 0\n",t);
else
{
res1=(float)(R-D)/(float)D;
if(res1 < 1)
res1 = 1;

res= (int)res1;
if(res1>res)
res++;
printf("Case %d: %d\n",t,res);
}

scanf("%d %d",&R,&D);

}
return 0;
}

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

Re: Why WA!! for 11723, help me please...

Post by brianfry713 » Sat Jul 20, 2013 12:08 am

Try solving it without using floating point.
Check input and AC output for thousands of problems on uDebug!

mobarak.islam
New poster
Posts: 38
Joined: Wed Dec 05, 2012 11:29 pm

Re: Why WA!! for 11723, help me please...

Post by mobarak.islam » Sat Jul 20, 2013 2:31 pm

I'm still getting wa though there is no floating point.

code is removed after getting ac.
Last edited by mobarak.islam on Tue Jul 23, 2013 7:24 am, edited 1 time in total.

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

Re: Why WA!! for 11723, help me please...

Post by brianfry713 » Sun Jul 21, 2013 11:53 am

input:

Code: Select all

55 2
0 0
AC output:

Code: Select all

Case 1: impossible
Check input and AC output for thousands of problems on uDebug!

mobarak.islam
New poster
Posts: 38
Joined: Wed Dec 05, 2012 11:29 pm

Re: Why WA!! for 11723, help me please...

Post by mobarak.islam » Sun Jul 21, 2013 4:25 pm

i resolved the issue but still getting wa :(
Last edited by mobarak.islam on Tue Jul 23, 2013 7:24 am, edited 1 time in total.

t.tahasin
New poster
Posts: 38
Joined: Tue May 28, 2013 11:21 pm

Re: Why WA!! for 11723, help me please...

Post by t.tahasin » Mon Jul 22, 2013 8:42 am

try this-

Input:

Code: Select all

75 3
76 3
77 3
78 3
79 3
80 3
0 0

Correct Output:

Code: Select all

Case 1: 24
Case 2: 25
Case 3: 25
Case 4: 25
Case 5: 26
Case 6: 26

mobarak.islam
New poster
Posts: 38
Joined: Wed Dec 05, 2012 11:29 pm

Re: Why WA!! for 11723, help me please...

Post by mobarak.islam » Tue Jul 23, 2013 7:23 am

I got AC. Thanks Mr. t.tahasin.

Post Reply

Return to “Volume 117 (11700-11799)”