結果

問題 No.105 arcの六角ボルト
ユーザー Mister
提出日時 2020-04-22 10:24:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 802 bytes
コンパイル時間 1,219 ms
コンパイル使用メモリ 102,092 KB
最終ジャッジ日時 2025-01-09 22:25:21
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

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