結果

問題 No.105 arcの六角ボルト
ユーザー antaanta
提出日時 2014-12-16 23:31:10
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,224 bytes
コンパイル時間 1,267 ms
コンパイル使用メモリ 81,924 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 15:25:23
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

typedef complex<double> Point;
int main() {
	const double PI = acos(-1.);
	const int K = 6;
	Point hex[K];
	rep(i, K)
		hex[i] = polar(1., PI * 2 / K * i);
	int T;
	scanf("%d", &T);
	rep(ii, T) {
		pair<double,double> XYs[K];
		rep(i, K)
			cin >> XYs[i].first >> XYs[i].second;
		sort(XYs, XYs + K);
		double ans = 1e99;
		do {
			double a = atan2(XYs[0].second, XYs[0].first);
			Point rot(cos(a), sin(a));
			bool ok = true;
			rep(i, K) {
				Point p(XYs[i].first, XYs[i].second);
//				cerr << hex[i] * rot << ", " << p << endl;
				ok &= abs(hex[i] * rot - p) < 1e-6;
			}
			if(ok) {
				double d = a / (PI * 2) * 360;
				while(d < 0) d += 180;
				amin(ans, d);
			}
		}while(next_permutation(XYs, XYs + K));
		printf("%.10f\n", ans);
	}
	return 0;
}
0