Page 2 of 2

### Re: 11805 - Bafana Bafana

Posted: Tue Nov 20, 2012 3:41 am
Input:

Code: Select all

``````1
23 23 68``````
AC output:

Code: Select all

``Case 1: 22``

### Re: 11805-Bafana Bafana

Posted: Fri Jan 03, 2014 7:32 am
naseef_07cuet wrote: Input:
1
12 14 18
This doesn't seem like it's a valid input. The problem statement clearly says that N (2 <= N <= 23), K (1 <= K <= N). Here K > N.

### Re: 11805 - Bafana Bafana

Posted: Fri Sep 19, 2014 5:00 am
why i get wa

Code: Select all

``````#include<iostream>
#include<cstdio>
int main(){

int n,p,k,remind,i,counter,l;
scanf("%d",&l);
for(int f=1;f<=l;f++){
scanf("%d%d%d",&n,&k,&p);
remind=p%n;
if(remind==0)
remind=n;
counter=k%n;;
int u=remind;
for(i=1;i<=u;i++){
if(counter==n)
{
if(i!=u){
counter=1;
}
}
else
{
counter++;
}
}
printf("Case %d: %d\n",f,counter);
}
return 0;
}``````

### Re: 11805 - Bafana Bafana

Posted: Fri Sep 19, 2014 11:23 am
Use code tags.

Input

Code: Select all

``````3
5 3 3
6 4 3
4 2 3``````
Acc Output

Code: Select all

``````Case 1: 1
Case 2: 1
Case 3: 1``````
Don't forget to remove your code after getting accepted.

### Re: 11805 - Bafana Bafana

Posted: Tue Nov 18, 2014 1:37 am
i dont know why my code is wrong ?

Code: Select all

``Removed after getting accepted``

### Re: 11805 - Bafana Bafana

Posted: Tue Nov 18, 2014 11:25 pm
Input:

Code: Select all

``````1
2 1 3
``````
AC output:

Code: Select all

``````Case 1: 2
``````

### Re: 11805 - Bafana Bafana

Posted: Wed Nov 19, 2014 1:44 am
thanx man

### Re: 11805 - Bafana Bafana

Posted: Thu May 21, 2015 3:36 pm
i tried my code by several test cases but still i am getting WA. i don't know why there are some test cases which is not valid like 12 14 18 as k<=n according to question. when k>=n my code is not showing correct outout. should i consider k>n but why?

Code: Select all

``````#include <stdio.h>
int main()
{
int n,k,p,t,i,j;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
int f=0;
scanf("%d %d %d",&n,&k,&p);
int j=k;
while(f!=p)
{
if(j>n)
{
j=1;
}
f++;
j++;

}

printf("Case %d: %d\n",i,j);

}

return 0;
}
``````

### Re: 11805 - Bafana Bafana

Posted: Thu May 21, 2015 4:39 pm
Got Accepted . There Was a little bug in my code as i took if condition at first. but now it's working

Code: Select all

``````#include <stdio.h>
int main()
{
int n,k,p,t,i,j;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
int f=0;
scanf("%d %d %d",&n,&k,&p);
int j=k;
while(f!=p)
{
f++;
j++;

if(j>n)
{
j=1;
}

}

printf("Case %d: %d\n",i,j);

}

return 0;
}
``````