Page 3 of 3

Re: 10347-WHY TLE???

Posted: Wed Apr 04, 2012 10:29 pm
by atiburrahman09
yeah....but why......


#include<iostream>
#include<stdio.h>
using namespace std;
#include<cmath>
#include<iomanip>
#include<cstdio>


int main(){
int med1,med2,med3;
double area,s,a,b,c,x;


while(cin>>med1>>med2>>med3)
{

if((med1+med2)>med3 && (med1+med3)>med2 && (med2+med3)>med1)
{
s=(med1+med2+med3)*0.5;
x=sqrt(s*(s-med1)*(s-med2)*(s-med3));
area=(4.000*x)/3.000;
}
else
area=-1.000;

if(area>=0)
cout<<fixed<<setprecision( 3 ) << area << endl;
else
cout<<1.000;
}


return 0;
}


this one is also giving WA....but why????

Re: 10347-WHY TLE???

Posted: Thu Apr 05, 2012 7:35 pm
by brianfry713
Input:
0 3 3

AC Output
-1.000

Re: 10347-WHY TLE???

Posted: Fri Aug 02, 2013 9:24 am
by brianfry713
try reading the input as doubles instead of ints.