Moderator: Board moderators

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10: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

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...

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...

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

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...

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

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

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...

#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...

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...

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...

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...

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...

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...

I got AC. Thanks Mr. t.tahasin.