## 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

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

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

### Re: 11909 - Soya Milk

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

large angle with L > H
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

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

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

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

### Re: 11909 - Soya Milk

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....
I'll keep holding on...Until the walls come tumbling down...And freedom is all around .....

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

### Re: 11909 - Soya Milk

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

Hello all I'm getting WA. But Why , 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

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

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

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

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

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: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11909 - Soya Milk

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.
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: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11909 - Soya Milk

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