Page 1 of 1
10693 - Traffic Volume
Posted: Wed Aug 04, 2004 9:12 pm
by jagadish
i am not able to understand if its a logical error or problem with floating points someone help me find the bug please..
[c]
code removed
[/c]
Posted: Wed Aug 04, 2004 10:24 pm
by prince56k
The main problem is here: b=(2*f*60*sqrtl(2*f1*l1)+eps) ;
Think more about it. I replace your formula by mine and get AC. again it's a 2 line code and u needn't use eps at all.
Posted: Thu Aug 05, 2004 7:53 am
by jagadish
thank you...i was so stupid not to notice that the previous formula was even dimensionally incorrect !
Posted: Thu Aug 05, 2004 5:49 pm
by sunhong
Here is my code. I calculate the sample output correctly,but got WA
many times.
Can anyone point out what is wrong in my code??
Posted: Thu Aug 05, 2004 7:53 pm
by jagadish
here is some sample i/o that may help..
10 3
12 2
8 9
100 10000
5 3
0 0
correct output:
7.74596669 1394.27400463
6.92820323 1039.23048454
12.00000000 2700.00000000
1414.21356237 25455.84412272
5.47722558 1971.80120702
Need to understand it.
Posted: Sun Aug 08, 2004 5:43 am
by _.B._
Thanks for helping!
Keep posting!
Posted: Sun Aug 08, 2004 5:52 am
by Larry
You can write the volume in terms of the velocity, so that part shouldn't be so hard. As for the velocity, you know that max (and mins) happen when the slope (derivative) is 0. So you just have to find the function that describes that..
Posted: Wed Feb 01, 2006 9:32 pm
by sv90
what will be the data type of this program
Posted: Thu Feb 02, 2006 6:52 am
by shamim
sv90 wrote:what will be the data type of this program
double should do it.
Posted: Thu Feb 02, 2006 7:08 am
by sv90
sv90 wrote:
this my code but i got WA!!!!!!!!!!!!!!!!!!
#include<stdio.h>
#include<math.h>
int main()
{
float V,volume;
float L,f;
while((scanf("%f%f",&L,&f))==2)
{
if((L==0)&&(f==0))
{
break;
}
V=sqrt(L*f*2.0);
volume=(V*3600)/(2*L);
printf("%.8f %.8f",V,volume);
}
return 0;
}
Posted: Thu Feb 02, 2006 3:25 pm
by shamim
Two changes are required to get AC.
There should be a newline after each case of output.
Also, change all data types to double.
Posted: Thu Feb 02, 2006 11:18 pm
by mamun
Would anybody kindly tell me how to make use of given L in this problem?
Re: 10693 - Traffic Volume
Posted: Wed Jun 09, 2010 2:52 pm
by yeasin_acm_solver
why i get wrong answer at this code:
PLZ Help Me.../*
Author : Muhammad Yeasin
University of Science & Technology Chittagong (USTC)
CSE- 11th Batch
Bangladesh Date: 5:32 AM 6/8/2010 UVA ID: 10693 Traffic Volume
*/
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#define pb push_back
#define file { freopen("input.txt","r",stdin);}
using namespace std;
int main()
{
int l,f;
//file
while(scanf("%d%d",&l,&f)==2){
if((l==0)&&(f==0))
break;
printf("%.8Lf ",sqrt(abs(l)*abs(f)*2.0));
if(f<0)
printf("-%.8Lf\n",(sqrt(abs(l)*abs(f)*2.0)*3600)/(2*abs(l)));
else
printf("%.8Lf\n",(sqrt(abs(l)*abs(f)*2.0)*3600)/(2*abs(l)));
}
return 0;
}