Page 1 of 2

11805 - Bafana Bafana

Posted: Sat Jul 03, 2010 6:47 pm
by yeasin_acm_solver
/*********************************************/
Muhammad Yeasin
University of Science & Technology Chittagong
(USTC)
CSE 11th Batch
E-mail: gigabyte_yeasin@yahoo.com
/*********************************************/

Accepted.

Input:

5
5 2 5
6 3 5
4 1 3
5 3 16
2 2 2

Output:

Case 1: 2
Case 2: 2
Case 3: 4
Case 4: 4
Case 5: 2

Re: 11805-Bafana Bafana

Posted: Sat Jul 03, 2010 7:16 pm
by sohel
What's your query?

Re: 11805-Bafana Bafana

Posted: Sat Jul 03, 2010 7:25 pm
by naseef_07cuet
????

Re: 11805-Bafana Bafana

Posted: Tue Jul 06, 2010 2:55 am
by apurba
I'm getting WA. Need some critical test cases.

Re: 11805-Bafana Bafana

Posted: Tue Jul 06, 2010 8:33 am
by sohel
It's very hard to get WA on this problem! Can you post your code?

Re: 11805-Bafana Bafana

Posted: Tue Jul 06, 2010 11:26 am
by apurba

Code: Select all

Got ACCEPTED and I was so #Stupid...

Thanks to all...

Re: 11805-Bafana Bafana

Posted: Tue Jul 06, 2010 12:41 pm
by robot
Hi apurba,
i think u forward wrong way
try this test case its help you
input
1
5 2 2
output: 4
plz think at right way
ASU(SUST)

Re: 11805-Bafana Bafana

Posted: Tue Jul 06, 2010 8:29 pm
by naseef_07cuet
try this:
Input:
5
3 2 1
21 19 200
23 22 199
12 14 18
5 5 9
Output will be:
Case 1: 3
Case 2: 9
Case 3: 14
Case 4: 8
Case 5: 4

Best of luck. happy coding :)

Re: 11805 - Bafana Bafana

Posted: Sat Nov 27, 2010 2:49 am
by solon_aguiar
I keep getting WA.
Tryed all inputs.
Can you guys help me?

Code: Select all

Removed after AC

Re: 11805 - Bafana Bafana

Posted: Sat Nov 27, 2010 4:39 am
by sohel
Check your code for this input

Code: Select all

1
2 2 3

Re: 11805 - Bafana Bafana

Posted: Wed Dec 01, 2010 1:01 pm
by naseef_07cuet
try to find all the output of all possible cases through your code... You will get it.

Re: 11805 - Bafana Bafana

Posted: Mon Dec 06, 2010 8:39 pm
by solon_aguiar
Thanks!
It was a silly mistake.
Got Accepted.

uva 11805

Posted: Thu Sep 13, 2012 2:15 pm
by pollob
Why WA??

import java.util.Scanner;


public class Main {

public static void main (String[] args){

Scanner scan =new Scanner (System.in);

int t, N, K, P, Case =0;

t =scan.nextInt();

while ((t--)>0){
N =scan.nextInt();
K =scan.nextInt();
P =scan.nextInt();

do{
K++;
if (K%N ==0) K =0;
}while ((--P)>0);

if (K==0) K =N;
System.out.println ("Case "+(++Case)+": "+K);
}

}
}

Re: uva 11805

Posted: Thu Sep 13, 2012 8:29 pm
by brianfry713
Input 2 2 1 AC output 1

Re: 11805 - Bafana Bafana

Posted: Sun Nov 18, 2012 9:01 am
by ahmed essam elkashef
can anybody tell me why i got wa ?? my code :
#include <iostream>
using namespace std ;
int main ()

{ int t ;
cin>>t;
for(int i=1;i<=t;i++)
{

int n, k , p ;
cin>>n>>k>>p;;
int d =k+p ;
int f=p-n ;
int l = f-n;
int result=l-n +k;
if ( n==p)
cout<<"Case " << i<<": "<< k<<endl ;
else if (n>p && d<=n)
cout<<"Case " << i<<": "<<d<<endl ;
else if (n>p && d>n)
cout<<"Case " << i<<": "<<d-n<<endl ;
else if (n<p && k+f<=n)
cout<<"Case " << i<<": "<<k+f<<endl;
else if (n<p && k+f>n&& l<n)
cout<<"Case " << i<<": "<<(k+f)-n<<endl ;
else if (l > n)
{
while( result> n)
result-=n;

cout<<"Case " << i<<": "<<result<< endl ;
}



}



return 0 ;

}