結果

問題 No.105 arcの六角ボルト
ユーザー tnakao0123tnakao0123
提出日時 2016-03-16 21:55:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 1,149 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 85,532 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 16:38:23
合計ジャッジ時間 1,320 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 105.cc: No.105 arcの六角ボルト - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

typedef long double ld;

const ld PI = acosl(-1.0);
const ld MIN_TH = 0.0;
const ld MAX_TH = PI * 50 / 180;

/* typedef */

/* global variables */

ld xs[6], ys[6];

/* subroutines */

/* main */

int main() {
  //printf("MIN_TH=%lf, MAX_TH=%lf\n", MIN_TH, MAX_TH);
  
  int tn;
  cin >> tn;

  while (tn--) {
    ld cx = 0.0, cy = 0.0;
    for (int i = 0; i < 6; i++) {
      cin >> xs[i] >> ys[i];
      cx += xs[i];
      cy += ys[i];
    }

    ld ans = 0.0;
    for (int i = 0; i < 6; i++) {
      ld th = atan2l(ys[i] - cy, xs[i] - cx);
      if (MIN_TH <= th && th < MAX_TH) {
	//printf("%d: (%lf,%lf)=%lf\n", i, x, y, th);
	ans = th * 180 / PI;
      }
    }

    printf("%.12Lf\n", ans);
  }

  return 0;
}
0