結果

問題 No.105 arcの六角ボルト
ユーザー MisterMister
提出日時 2020-04-22 10:24:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 1,432 ms
コンパイル使用メモリ 104,584 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-04-19 09:09:39
合計ジャッジ時間 1,536 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

using ldouble = long double;
constexpr ldouble EPS = 1e-12;
const ldouble PI = std::acos(-1L);

void solve() {
    std::vector<ldouble> thetas(6);
    for (auto& theta : thetas) {
        ldouble x, y;
        std::cin >> x >> y;
        theta = std::atan2(y, x);
    }

    std::sort(thetas.rbegin(), thetas.rend());
    auto theta = thetas.front();
    for (auto t : thetas) {
        if (t < -EPS) break;
        theta = std::min(theta, t);
    }

    std::cout << std::fixed << std::setprecision(15)
              << theta * 180 / PI << std::endl;
}

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

    int q;
    std::cin >> q;
    while (q--) solve();

    return 0;
}
0