11909 - Soya Milk

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

Moderator: Board moderators

Pro.metal
New poster
Posts: 9
Joined: Fri Dec 17, 2010 8:13 pm

11909 - Soya Milk

Post by Pro.metal » Thu Feb 10, 2011 8:01 am

I am getting WA for this problem. I get the exact ans for the sample I/O.
plz help.

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

Re: 11909 - Soya Milk

Post by sohel » Thu Feb 10, 2011 8:44 am

What if the angle is very large?

zobayer
Experienced poster
Posts: 110
Joined: Tue May 06, 2008 2:18 pm
Location: CSE-DU, Bangladesh
Contact:

Re: 11909 - Soya Milk

Post by zobayer » Thu Feb 10, 2011 8:36 pm

large angle with L > H :D
You should not always say what you know, but you should always know what you say.

Shafaet_du
Experienced poster
Posts: 147
Joined: Mon Jun 07, 2010 11:43 am
Location: University Of Dhaka,Bangladesh
Contact:

Re: 11909 - Soya Milk

Post by Shafaet_du » Fri Feb 11, 2011 6:39 am

Nice problem :).

Sample I/0:

Code: Select all

89 5 10 80
output:

Code: Select all

44.082 mL

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11909 - Soya Milk

Post by naseef_07cuet » Wed Mar 09, 2011 1:48 am

I am confused about the process of solving. Can anyone discuss about that?
If you have determination, you can do anything you want....:)

User avatar
shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

Re: 11909 - Soya Milk

Post by shaon_cse_cu08 » Sat Jun 18, 2011 1:37 pm

Suparb problem...!! for the condition where l>h && Angle is very large... we have to check whether the surface of the milk is in between 'h' or not...that is if (l*tan(ang))>h
then only the portion of milk that is Volume of the Triangle is the result.... :D
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... :x

User avatar
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 11909 - Soya Milk

Post by plamplam » Sat Jun 18, 2011 5:22 pm

I solved this in my first try. I must agree with everyone else, this is a really great problem. Please don't underestimate the problem. Although the problem description says that it may not perfectly match the real-life situation, I am going to advice you to visualize this as a real-life situation. Here are some test cases if you get WA.

2 8 9 85
17 32 87 5
17 9 87 82

Output should be:
28.346 mL
46923.452 mL
4786.891 mL

respectively
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

Why 11909 is WA, help please

Post by esharif » Mon Jun 25, 2012 5:34 pm

Hello all I'm getting WA. But Why :oops: , though I test the cases 9 6 19 20 & 89 5 10 80, have any more critical input? or let see the code mine below:

Code: Select all

#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include<stdio.h>
#include<stdlib.h>
#define PI 4*atan(1)

int main()
{
	float l, w, h, th, vol, tvol, v, o, result, area, res;
	while(scanf("%f%f%f%f", &l,&w, &h, &th)==4)
	{
        if(l<=h)
        {
            result=cos (th*PI/180);
            o=l/result;
            v=sqrt(o*o-l*l);
            vol=.5*l*v*w;
            tvol=l*w*h;
            res=tvol-vol;
        }
        else if(l>h)
        {
            result=tan((90-th)*PI/180);
            v=h*result;
            vol=.5*v*h*w;
            res=vol;
        }
        printf("%.3f mL\n",res);
    }
	return 0;
}
[/color]

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

Re: Why 11909 is WA, help please

Post by brianfry713 » Mon Jun 25, 2012 11:56 pm

Try using double instead of float.
Check input and AC output for thousands of problems on uDebug!

esharif
New poster
Posts: 18
Joined: Sun Jun 03, 2012 11:56 pm

Re: Why 11909 is WA, help please

Post by esharif » Tue Jun 26, 2012 6:04 pm

For double the problem gives o/p 0.000 but for long double gives correct answer at my compiler but UVA gives me WA. What can I do now?

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

Re: Why 11909 is WA, help please

Post by brianfry713 » Wed Jun 27, 2012 12:33 am

Try the cases in this thread: http://acm.uva.es/board/viewtopic.php?t=51535
Check input and AC output for thousands of problems on uDebug!

FlavioBayer
New poster
Posts: 1
Joined: Sat Feb 15, 2014 11:41 pm

Re: Why 11909 is WA, help please

Post by FlavioBayer » Sat Feb 15, 2014 11:47 pm

Try this test case
Input:

Code: Select all

1 1 1 89
Output:

Code: Select all

0.009 mL

nasim.ruet
New poster
Posts: 10
Joined: Sat Sep 06, 2014 12:44 pm

Re: 11909 - Soya Milk

Post by nasim.ruet » Tue Sep 23, 2014 3:52 pm

:lol: :lol:

Code: Select all

Remove after AC
Last edited by nasim.ruet on Tue Sep 23, 2014 8:12 pm, edited 1 time in total.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11909 - Soya Milk

Post by lighted » Tue Sep 23, 2014 6:41 pm

My advice to you -> always copy/paste output format from sample or problem description.
Input

Code: Select all

9 6 19 20
Sample Output

Code: Select all

937.555 ml
Your Output

Code: Select all

937.555 mL
Don't forget to remove all your codes after getting accepted. 8)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11909 - Soya Milk

Post by lighted » Tue Sep 23, 2014 6:53 pm

Input

Code: Select all

9 6 19 20
89 5 10 80
2 8 9 85
1 1 1 89
17 32 87 5
17 9 87 82
1 2 3 45
34 56 23 23
45 23 89 78
32 12 28 1
4 7 1 70
Acc Output

Code: Select all

937.555 mL
44.082 mL
28.346 mL
0.009 mL
46923.452 mL
4786.891 mL
5.000 mL
30052.599 mL
19362.096 mL
10644.756 mL
1.274 mL
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Post Reply

Return to “Volume 119 (11900-11999)”