10465 - Homer Simpson

All about problems in Volume 104. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Rajputro
New poster
Posts: 6
Joined: Fri Jan 10, 2003 4:19 pm
Location: Dhaka,Bangladesh
Contact:

At last

Post by Rajputro » Sun Mar 09, 2003 6:35 pm

Understood the problem and Got accepted :D:D:D:D:D:D:D

123 12 21 was the faulty input which helped me to correct my problem
-->Shafi

" Rajputro has spoken. "

Sajid
Learning poster
Posts: 94
Joined: Sat Oct 05, 2002 5:34 pm
Location: CS - AIUB, Dhaka, Bangladesh.
Contact:

Post by Sajid » Tue Mar 18, 2003 7:17 pm

hi, still WA.. but all the inputs show the correct outputs discussed in this board...

what is the output of the following input?

Code: Select all

123 12 21 
Sajid Online: www.sajidonline.com

User avatar
kmhasan
Problemsetter
Posts: 107
Joined: Fri Oct 26, 2001 2:00 am
Location: Canada
Contact:

Post by kmhasan » Tue Mar 18, 2003 7:30 pm

Code: Select all

123 12 21
Seems to be a trivial case. The output will be:

Code: Select all

1 9
Homer can have 1 burger (2nd type) and will have 9 minutes to waste (to have beer).

Sajid
Learning poster
Posts: 94
Joined: Sat Oct 05, 2002 5:34 pm
Location: CS - AIUB, Dhaka, Bangladesh.
Contact:

Post by Sajid » Tue Mar 18, 2003 7:34 pm

that's ok in my program,, and still cant find any wrong...
Sajid Online: www.sajidonline.com

Derk
New poster
Posts: 23
Joined: Mon Mar 17, 2003 3:53 am
Location: Louisville, KY
Contact:

Ditto!

Post by Derk » Mon Mar 24, 2003 8:41 am

I can't get mine accepted either, and I've thrown every piece of input I can think at it. I've tested it with all the ones on here too -- every time it comes back WA. I'm always sure to test if I can get more burgers with the same amount of beertime, too. Can someone with an accepted solution post a bunch of input and corresponding output?

Eric
Learning poster
Posts: 83
Joined: Wed Sep 11, 2002 6:28 pm
Location: Hong Kong

Post by Eric » Mon Apr 14, 2003 10:03 am

I have passed all the test cases in the post.
But I still get WA.
Can anyone give me more sample I/O?
Last edited by Eric on Thu Apr 24, 2003 5:52 am, edited 1 time in total.

titid_gede
Experienced poster
Posts: 187
Joined: Wed Dec 11, 2002 2:03 pm
Location: Mount Papandayan, Garut

10465 - Hommer Simpson

Post by titid_gede » Tue Apr 22, 2003 5:22 pm

Are there critical input for this problems? i've passed all test case given in another post.

alelevi
New poster
Posts: 2
Joined: Tue Apr 22, 2003 7:08 pm
Location: Argentina
Contact:

Re: Still Confused :(

Post by alelevi » Tue Apr 22, 2003 7:15 pm

Rajputro wrote:My sample inputs
11 2 13
2 5 25

My programme's output...

2
11
For those two inputs I get:
6 1
12 1

I have to try not to drink beer? If there's a case where I don't drink beer, but the amount of hamburguers is less than anotherone where I drink beer, I should nevertheless use that output??

Eric
Learning poster
Posts: 83
Joined: Wed Sep 11, 2002 6:28 pm
Location: Hong Kong

Post by Eric » Wed Apr 23, 2003 7:28 am

You should not drink beer if there exists any way that you can.
So the output should be 2 and 11 instead of yours.
Btw, I still get WA. Can anyone help me?

alelevi
New poster
Posts: 2
Joined: Tue Apr 22, 2003 7:08 pm
Location: Argentina
Contact:

:D

Post by alelevi » Wed Apr 23, 2003 5:46 pm

Finally got accepted!
Thank you all!
I made my code in C, so if anyone needs help with a C code, just post your question at acm@somnius.com.ar .
See ya,
Ale.

titid_gede
Experienced poster
Posts: 187
Joined: Wed Dec 11, 2002 2:03 pm
Location: Mount Papandayan, Garut

Post by titid_gede » Sat Apr 26, 2003 4:46 pm

at first, to me the main problem is when n multiple of m. but i still got WA till now. here is my WA code
[c]
#include <stdio.h>

int main() {
int a, b, c, temp, jum;

while (1) {
if (scanf ("%d %d %d", &a, &b, &c) != 3) break;
if (b < a) {
temp = a;
a = b;
b = temp;
}
jum = 0;
while (c >= b && c%a != 0) {
c -= b;
jum++;
}
if (b%a == 0 && b != a) jum *= 2;
if (c != 0 && c/a >= 1) {
jum += (c/a);
c = c%a;
}
printf ("%d", jum);
if (c%a != 0) printf (" %d", c);
printf ("\n");
}
return 0;
}

[/c]
Kalo mau kaya, buat apa sekolah?

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

Post by sohel » Sun Apr 27, 2003 12:18 pm

Remember beer time has got to be minimum;

sample input
123 124 125

Output is
1 1

and not
1 2

elsa@nnnn
New poster
Posts: 5
Joined: Wed May 07, 2003 5:49 pm

10465 wa. please help me!

Post by elsa@nnnn » Wed May 07, 2003 5:53 pm

here is my code . I am a new here#include<stdio.h>
int main()
{
int n,m,t,k;
int max1,max2,time,num1,num2;
bool find;
while(scanf("%d %d %d",&m,&n,&t)==3)
{
if(m==1 || n==1) {
printf("%d\n",t);
continue;
}
max1=max2=0;
find=false;
if(n<m) {
int temp=n;
n=m;
m=temp;
}
time=t;
int rest;
for(num1=0;num1<=t/m ; num1++)
{
rest=t-num1*m;
if(rest >=0 &&rest %n ==0) {
if(rest/n +num1>max1 )
{
find=true;
max1=rest/n +num1;
}
}else if(rest >=0 && rest %n !=0 )
{
if(rest/n +num1>max2)
{
max2=rest/n+num1;
time =rest%n;
}
}

}
if(find) printf("%d\n",max1);
else printf("%d %d\n",max2,time);

}
return 0;
}

Red Scorpion
Experienced poster
Posts: 192
Joined: Sat Nov 30, 2002 5:14 am

Post by Red Scorpion » Thu May 08, 2003 5:23 am

Hi!

Try this test cases:
9 7 6 2
2 5 6
45 23 91
5 9 19

output
8
3
3
3

:wink:

elsa@nnnn
New poster
Posts: 5
Joined: Wed May 07, 2003 5:49 pm

Post by elsa@nnnn » Thu May 08, 2003 6:59 am

I am puzzled with this problem.
I have passed all the sample input shown in another post ,but I still got wa.
I use " if( rest%m <time || (rest%m==time && rest/n +num1>max2) ) "
to nininum the time for drinking beer and if with the same time maxnum the burger num.

Post Reply

Return to “Volume 104 (10400-10499)”