結果

問題 No.105 arcの六角ボルト
ユーザー bal4ubal4u
提出日時 2019-07-26 18:07:00
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 29,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 00:24:39
合計ジャッジ時間 937 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// yukicoder: No.105 arcの六角ボルト
// 2019.7.26 bal4u

#include <stdio.h>
#include <math.h>

#define EPS 1e-10
#define ZERO(x) (fabs(x)<=EPS)
#define MAGIC  57.295779513082320876798154814105    // 180/Pi

int main()
{
	int i, f, T;
	double x, y, a, ans;

	scanf("%d", &T);
	while (T--) {
		ans = 90.0, f = 1;
		for (i = 0; i < 6; i++) {
			scanf("%lf%lf", &x, &y);
			if (f && x > 0 && (ZERO(y) || y >= 0)) {
				if (ZERO(y)) f = 0;
				else {
					a = atan2(y, x) * MAGIC;
					if (a < ans) ans = a;
				}
			}
		}
		if (f) printf("%.12lf\n", ans);
		else puts("0.000000000000");
	}
	return 0;
}
0