結果

問題 No.1447 Greedy MtSaka
ユーザー chacoder1chacoder1
提出日時 2021-05-12 22:46:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 201,424 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 17:40:47
合計ジャッジ時間 3,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
#define int long long

double men(double x1,double y1,double x2,double y2,double x3,double y3){
  double menseki=0;
  double a1=sqrt(pow(abs(x2-x1),2)+pow(abs(y2-y1),2));
  double b1=sqrt(pow(abs(x3-x2),2)+pow(abs(y3-y2),2));
  double c1=sqrt(pow(abs(x3-x1),2)+pow(abs(y3-y1),2));
  double s=(a1+b1+c1)/2;
  menseki=sqrt(s*(s-a1)*(s-b1)*(s-c1));
  return menseki;
}

signed main(){
  int n;
  cin>>n;
  double x[n],y[n];
  rep(i,n){
    cin>>x[i]>>y[i];
  }
  double ans=0;
  rep(i,n-2){
    ans+=men(x[0],y[0],x[i+1],y[i+1],x[i+2],y[i+2]);
  }
  cout<<ans*2<<endl;
  return 0;
}

0