結果

問題 No.105 arcの六角ボルト
ユーザー masamasa
提出日時 2015-04-02 10:24:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 576 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 66,700 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-17 01:10:39
合計ジャッジ時間 994 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:34: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   double diff = x == 0 ? 0 : atan(y / x) * 180 / M_PI;
                              ~~~~^~~~~~~

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>

using namespace std;

const double EPS = 1e-12;

int main() {
	int t;
	double in_x, in_y, x, y;

	cin >> t;
	vector<double> ans(t, 0.0);
	for (int i = 0; i < t; i++) {
		x = -100;
		for (int i = 0; i < 6; i++) {
			cin >> in_x >> in_y;

			if (in_y >= -EPS && in_x > x) {
				x = in_x;
				y = in_y;
			}
		}

		double diff = x == 0 ? 0 : atan(y / x) * 180 / M_PI;
		ans[i] = diff;
	}

	for (int i = 0; i < t; i++) {
		printf("%.16f\n", ans[i]);
	}
	return 0;
}
0