11805 - Bafana Bafana

Moderator: Board moderators

yeasin_acm_solver
New poster
Posts: 11
Joined: Wed Jun 09, 2010 2:30 pm
Location: University Of Science & Technology Chittagong (USTC) Bangladesh

11805 - Bafana Bafana

/*********************************************/
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
Last edited by yeasin_acm_solver on Fri Jul 09, 2010 8:15 am, edited 2 times in total.

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11805-Bafana Bafana

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm

Re: 11805-Bafana Bafana

????
If you have determination, you can do anything you want....

apurba
New poster
Posts: 42
Joined: Sun Oct 07, 2007 10:29 pm

Re: 11805-Bafana Bafana

I'm getting WA. Need some critical test cases.

Code: Select all

``keep dreaming...``

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11805-Bafana Bafana

It's very hard to get WA on this problem! Can you post your code?

apurba
New poster
Posts: 42
Joined: Sun Oct 07, 2007 10:29 pm

Re: 11805-Bafana Bafana

Code: Select all

``````Got ACCEPTED and I was so #Stupid...

Thanks to all...
``````
Last edited by apurba on Wed Jul 07, 2010 2:51 am, edited 1 time in total.

Code: Select all

``keep dreaming...``

robot
New poster
Posts: 29
Joined: Sun May 24, 2009 8:39 pm

Re: 11805-Bafana Bafana

Hi apurba,
i think u forward wrong way
input
1
5 2 2
output: 4
plz think at right way
ASU(SUST)

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm

Re: 11805-Bafana Bafana

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
If you have determination, you can do anything you want....

solon_aguiar
New poster
Posts: 7
Joined: Mon Jun 08, 2009 11:16 pm

Re: 11805 - Bafana Bafana

I keep getting WA.
Tryed all inputs.
Can you guys help me?

Code: Select all

``````Removed after AC
``````
Last edited by solon_aguiar on Mon Dec 06, 2010 8:39 pm, edited 1 time in total.

sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11805 - Bafana Bafana

Check your code for this input

Code: Select all

``````1
2 2 3``````

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm

Re: 11805 - Bafana Bafana

try to find all the output of all possible cases through your code... You will get it.
If you have determination, you can do anything you want....

solon_aguiar
New poster
Posts: 7
Joined: Mon Jun 08, 2009 11:16 pm

Re: 11805 - Bafana Bafana

Thanks!
It was a silly mistake.
Got Accepted.

pollob
New poster
Posts: 2
Joined: Wed Sep 12, 2012 9:55 am

uva 11805

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);
}

}
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: uva 11805

Input 2 2 1 AC output 1
Check input and AC output for thousands of problems on uDebug!

ahmed essam elkashef
New poster
Posts: 1
Joined: Sun Nov 18, 2012 8:45 am

Re: 11805 - Bafana Bafana

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 ;

}