Page 1 of 1

11437 - Triangle Fun

Posted: Wed Apr 17, 2013 10:19 am
by Sabiha_Fancy
I am getting wrong answer. help me.
here is my code:

Code: Select all

removed after ac

11437 - Triangle Fun

Posted: Wed Mar 26, 2014 6:07 pm
by pralgomathic
can anyone please tell where I have made the mistakes, it's getting me WA! :( Please help .thanks

Code: Select all

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    double ax,ay,bx,by,cx,cy;

    int n;
    while(cin>>n)
    {
        for(int i=0;i<n;i++)
        {
            cin>>ax>>ay>>bx>>by>>cx>>cy;
            long double a,b,c;
            long double area;
            a = ax*(by-cy);
            b = bx*(cy-ay);
            c = cx*(ay-by);
            area = abs((a+b+c)/2);
            //long long  res = (long long)(area/7);
            //cout<<res<<endl;
            cout<<floor(area/7)<<endl;
        }


    }

    return 0;


}


Re: 11437 - Triangle Fun

Posted: Wed Mar 26, 2014 8:47 pm
by brianfry713
Only read N once.
In my AC code I used only double, no long doubles.