12290 - Counting Game

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

Moderator: Board moderators

Post Reply
Repon kumar Roy
Learning poster
Posts: 96
Joined: Tue Apr 23, 2013 12:54 pm

12290 - Counting Game

Post by Repon kumar Roy »

I used simple loop and check the conditions for clapping . ...
I got WA .. . Is there any case for -1 ?
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12290 - Counting Game

Post by brianfry713 »

Is there any case for -1 ?
No
Check input and AC output for thousands of problems on uDebug!
Repon kumar Roy
Learning poster
Posts: 96
Joined: Tue Apr 23, 2013 12:54 pm

Re: 12290 - Counting Game

Post by Repon kumar Roy »

Got AC :)
Some more test Cases
Input :

Code: Select all


100 7 1
100 7 2
100 7 3
2 1 1000
77 7 77
77 77 77
19 19 27
0 0 0
OutPut :

Code: Select all

7
787
799
4579
10787
25157
1855
Last edited by Repon kumar Roy on Wed Mar 05, 2014 6:35 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12290 - Counting Game

Post by brianfry713 »

Input

Code: Select all

100 7 1
0 0 0
output 7
Check input and AC output for thousands of problems on uDebug!
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 12290 - Counting Game

Post by uDebug »

Repon kumar Roy wrote:Some more test Cases
Thanks for sharing. Those are some great test cases!
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am
Location: Rangpur, Bangladesh

Re: 12290 - Counting Game

Post by Shahidul.CSE »

Repon kumar Roy wrote:Got AC :)
Some more test Cases
Input :

Code: Select all


100 7 1
100 7 2
100 7 3
2 1 1000
77 7 77
77 77 77
19 19 27
0 0 0
OutPut :

Code: Select all

7
787
799
4579
10787
25157
1855
My code is giving correct output for all the cases except the last two cases.
for 77 77 77 its giving 25158 instead of 25157
and for 19 19 27 its giving 1856 instead of 1855

And therefore I am getting WA.
My code:

Code: Select all

#include<stdio.h>
int main()
{
    long long int n,m,k,i,j,clap,count,cl,v,r;
    while(scanf("%lld %lld %lld",&n,&m,&k)==3)
    {
        if(n==0 && m==0 && k==0)
            break;
        count=cl=0;
        for(i=1;i<=n;i++)
        {
            count++;
            if(i==m)
            {
                if(count%7==0)
                    cl++;
                else
                {
                    v=count;
                    while(v>0)
                    {
                        r=v%10;
                        if(r==7)
                        {
                            cl++;
                            break;
                        }
                        v=v/10;
                    }
                }
            }
            if(i==n)
            {
              for(j=n-1;j>1;j--)
              {
                 count++;
                 if(j==m)
                 {
                    if(count%7==0)
                        cl++;
                     else
                     {
                        v=count;
                        while(v>0)
                        {
                            r=v%10;
                            if(r==7)
                            {
                                cl++;
                                break;
                            }
                            v=v/10;
                        }
                      }
                  }
                  if(cl==k)
                  {
                      clap=count;
                      break;
                  }
               }
               i=0;
            }
            if(cl==k)
            {
                clap=count;
                break;
            }
        }
        printf("%lld\n",clap);
    }
    return 0;
}
Whats wrong or where to change in my code?
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
Post Reply

Return to “Volume 122 (12200-12299)”