11805 - Bafana Bafana
Moderator: Board moderators
-
- New poster
- Posts: 11
- Joined: Wed Jun 09, 2010 2:30 pm
- Location: University Of Science & Technology Chittagong (USTC) Bangladesh
11805 - Bafana Bafana
/*********************************************/
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
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
Last edited by yeasin_acm_solver on Fri Jul 09, 2010 8:15 am, edited 2 times in total.
-
- Learning poster
- Posts: 62
- Joined: Sat Nov 21, 2009 10:17 pm
- Location: CUET,Chittagong,Bangladesh
Re: 11805-Bafana Bafana
I'm getting WA. Need some critical test cases.
Code: Select all
keep dreaming...
Re: 11805-Bafana Bafana
It's very hard to get WA on this problem! Can you post your code?
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...
Re: 11805-Bafana Bafana
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)
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)
-
- Learning poster
- Posts: 62
- Joined: Sat Nov 21, 2009 10:17 pm
- Location: CUET,Chittagong,Bangladesh
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
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....

-
- New poster
- Posts: 7
- Joined: Mon Jun 08, 2009 11:16 pm
Re: 11805 - Bafana Bafana
Last edited by solon_aguiar on Mon Dec 06, 2010 8:39 pm, edited 1 time in total.
Re: 11805 - Bafana Bafana
Check your code for this input
Code: Select all
1
2 2 3
-
- Learning poster
- Posts: 62
- Joined: Sat Nov 21, 2009 10:17 pm
- Location: CUET,Chittagong,Bangladesh
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....

-
- New poster
- Posts: 7
- Joined: Mon Jun 08, 2009 11:16 pm
Re: 11805 - Bafana Bafana
Thanks!
It was a silly mistake.
Got Accepted.
It was a silly mistake.
Got Accepted.
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);
}
}
}
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);
}
}
}
-
- 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!
-
- 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 ;
}
#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 ;
}