10693 - Traffic Volume
Moderator: Board moderators
10693 - Traffic Volume
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]
[c]
code removed
[/c]
Last edited by jagadish on Thu Aug 05, 2004 7:51 am, edited 1 time in total.
Need to understand it.
Thanks for helping!
Keep posting!
Keep posting!
Last edited by _.B._ on Sun Aug 08, 2004 5:21 pm, edited 1 time in total.
_.
Two changes are required to get AC.
There should be a newline after each case of output.
Also, change all data types to double.
Code: Select all
printf("%.8f %.8f",V,volume);
Also, change all data types to double.
-
- New poster
- Posts: 11
- Joined: Wed Jun 09, 2010 2:30 pm
- Location: University Of Science & Technology Chittagong (USTC) Bangladesh
Re: 10693 - Traffic Volume
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;
}
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;
}