I used simple loop and check the conditions for clapping . ...
I got WA .. . Is there any case for -1 ?
12290 - Counting Game
Moderator: Board moderators
-
- Learning poster
- Posts: 96
- Joined: Tue Apr 23, 2013 12:54 pm
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12290 - Counting Game
NoIs there any case for -1 ?
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 96
- Joined: Tue Apr 23, 2013 12:54 pm
Re: 12290 - Counting Game
Got AC
Some more test Cases
Input :
OutPut :
![:)](./images/smilies/icon_smile.gif)
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
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.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 12290 - Counting Game
Inputoutput 7
Code: Select all
100 7 1
0 0 0
Check input and AC output for thousands of problems on uDebug!
-
- Experienced poster
- Posts: 148
- Joined: Sun Jul 13, 2014 4:32 am
- Location: Rangpur, Bangladesh
Re: 12290 - Counting Game
My code is giving correct output for all the cases except the last two cases.Repon kumar Roy wrote:Got AC![]()
Some more test Cases
Input :OutPut :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
Code: Select all
7 787 799 4579 10787 25157 1855
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;
}
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
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