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

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

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

Post by uDebug »

Here's all the AC input / output I could find on the forums in one place.

Input

Code: Select all

75 3
76 3
77 3
78 3
79 3
80 3
55 2
900 90
32 8
52 2
8 4
1 1
1 56
53 2
11 6
7 7
0 0
AC Output

Code: Select all

Case 1: 24
Case 2: 25
Case 3: 25
Case 4: 25
Case 5: 26
Case 6: 26
Case 7: impossible
Case 8: 9
Case 9: 3
Case 10: 25
Case 11: 1
Case 12: 0
Case 13: 0
Case 14: 26
Case 15: 1
Case 16: 0
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
imunir
New poster
Posts: 1
Joined: Thu May 21, 2015 6:01 pm

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

Post by imunir »

my code is

Code: Select all

#include <stdio.h>

int main()
{

    long long int r,n,i=1,l;
    while(scanf("%lld %lld",&r,&n)==2)
    {
        if(n==0 || r==0)
            break;
        l=(r-1)/n;

        if(l>26)
            printf("Case %lld: Impossible\n",i);
        else
            printf("Case %lld: %lld\n",i,l);
        i++;
    }

    return 0;
}
Last edited by brianfry713 on Fri Jun 19, 2015 7:05 am, edited 1 time in total.
Reason: Added code blocks
liya
New poster
Posts: 10
Joined: Fri Jan 23, 2015 2:36 pm

Re: 11723 - Numbering Roads

Post by liya »

getting WA!!!!!!!! :( I NEED HELP!!!

Code: Select all

#include<stdio.h>
int main()
{
   long long int i,r,n,t,j,s;
    for(i=1; ;i++ )
    {
        scanf("%lld %lld",&r,&n);
        if(r==0&&n==0)
        {
            break;
        }
        if((n*26)+n<r)
        {
            printf("Case %lld: impossible\n",i);
        }
        else
        {
            if((r-n)%n==0)
            {
                s=(r-n)/n;
                printf("Case %lld: %lld\n",i,s);
            }
            else
            {
                if(1<=(r-n)%n<n)
                {
                    t=1;
                }
                j=(r-n)/n;
                printf("Case %lld: %lld\n",i,j+t);
            }
        }
    }
    return 0;

}
Last edited by brianfry713 on Fri Jun 19, 2015 7:05 am, edited 1 time in total.
Reason: Added code blocks
Post Reply

Return to “Volume 117 (11700-11799)”