結果

問題 No.105 arcの六角ボルト
ユーザー data9824data9824
提出日時 2015-06-01 03:35:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 656 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 70,800 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-20 18:11:04
合計ジャッジ時間 1,073 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>

using namespace std;

const double PI = acos(-1);

double angle(const double x[], const double y[]) {
	const double MAX_ERROR = 1e-6;
	double theta[6];
	for (int i = 0; i < 6; ++i) {
		theta[i] = fmod(atan2(y[i], x[i]) + MAX_ERROR + 2 * PI, 2 * PI);
	}
	sort(&theta[0], &theta[5] + 1);
	return (theta[0] - MAX_ERROR) * 180 / PI;
}

int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		double x[6], y[6];
		for (int k = 0; k < 6; ++k) {
			cin >> x[k] >> y[k];
		}
		double result = angle(x, y);
		cout << fixed << setprecision(12) << result << endl;
	}
	return 0;
}
0