結果

問題 No.2352 Sharpened Knife in Fall
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-16 12:18:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 483 ms / 3,000 ms
コード長 867 bytes
コンパイル時間 2,484 ms
コンパイル使用メモリ 201,296 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 12:18:59
合計ジャッジ時間 15,739 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 369 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 483 ms
5,376 KB
testcase_07 AC 227 ms
5,376 KB
testcase_08 AC 459 ms
5,376 KB
testcase_09 AC 450 ms
5,376 KB
testcase_10 AC 456 ms
5,376 KB
testcase_11 AC 479 ms
5,376 KB
testcase_12 AC 457 ms
5,376 KB
testcase_13 AC 460 ms
5,376 KB
testcase_14 AC 212 ms
5,376 KB
testcase_15 AC 453 ms
5,376 KB
testcase_16 AC 24 ms
5,376 KB
testcase_17 AC 12 ms
5,376 KB
testcase_18 AC 163 ms
5,376 KB
testcase_19 AC 361 ms
5,376 KB
testcase_20 AC 141 ms
5,376 KB
testcase_21 AC 136 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}
#define PI 3.14159265358979323846
int main() {
    fast_io();
    int R, k;
    cin >> R >> k;
    vector<double> ans;
    for (int i = 1; i <= k / 2; i++) {
        auto f = [&](double theta) { return theta - sin(2 * theta) / 2; };
        double l = 0, r = PI / 2;
        for (int j = 0; j < 100; j++) {
            double m = (l + r) / 2;
            if (f(m) < PI * i / (k + 1)) {
                l = m;
            } else {
                r = m;
            }
        }
        ans.push_back(R * cos(l));
        ans.push_back(-R * cos(l));
    }
    if (k % 2 == 1) {
        ans.push_back(0);
    }
    sort(ans.begin(), ans.end());
    cout << setprecision(16) << fixed;
    for (auto e : ans) {
        cout << e << endl;
    }
}
0