結果

問題 No.105 arcの六角ボルト
コンテスト
ユーザー hotpepsi
提出日時 2014-12-18 00:36:31
言語 C++11(old_compat)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -include bits/stdc++.h -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 855 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,404 ms
コンパイル使用メモリ 171,912 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2026-03-08 16:00:49
合計ジャッジ時間 1,874 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
	cout.precision(16);
	string s;
	getline(cin, s);
	int N = atoi(s.c_str());
	double a[6] = { atan2(0,1), atan2(sqrt(3)*0.5,0.5), atan2(sqrt(3)*0.5,-0.5),
			atan2(0, -1), atan2(-sqrt(3)*0.5, -0.5) + 2 * M_PI, atan2(-sqrt(3)*0.5, 0.5) + 2 * M_PI };
	for (int t = 0; t < N; ++t) {
		getline(cin, s);
		double rad[6];
		for (int i = 0; i < 6; ++i) {
			double x, y;
			getline(cin, s);
			stringstream ss(s);
			ss >> x >> y;
			rad[i] = atan2(y,x);
			if (rad[i] < 0) {
				rad[i] += 2 * M_PI;
			}
		}
		sort(rad, rad + 6);
		double d = rad[0] / (2 * M_PI) * 360;
		if (d >= (60 - 1.0e-8)) {
			d -= 60;
		}
		if (d <= 1.0e-8) {
			d = 0;
		}
		cout << d << endl;
	}
	return 0;
}
0