結果

問題 No.105 arcの六角ボルト
ユーザー msm1993msm1993
提出日時 2020-11-18 16:15:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 916 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 170,408 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-30 15:04:24
合計ジャッジ時間 2,213 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	constexpr long REV = 1e11;

	vector<double> th0(6);
	th0[0] = 0.0;
	th0[1] = M_PI / 3;
	th0[2] = M_PI * 2 / 3;
	th0[3] = M_PI;
	th0[4] = M_PI * 4 / 3;
	th0[5] = M_PI * 5 / 3;

	int t;
	cin >> t;

	stringstream ss;
	for (int i = 0; i < t; ++i)
	{
		vector<double> th(6);
		for (int j = 0; j < 6; ++j)
		{
			double x, y;
			cin >> x >> y;
			long xi = (long)(x * REV);
			long yi = (long)(y * REV);
			double thw = atan2(yi, xi);
			if (thw < 0)
				thw += 2 * M_PI;
			th[j] = thw;
		}

		sort(th.begin(), th.end());

		double dth{ 0 };
		for (int j = 0; j < 6; ++j)
		{
			dth += th[j] - th0[j];
		}
		dth *= 180 / M_PI;
		dth /= 6.0;

		ss << fixed << setprecision(15) << dth << "\n";
	}

	cout << ss.str();

	return 0;
}
0