結果

問題 No.2352 Sharpened Knife in Fall
ユーザー ぷらぷら
提出日時 2023-06-16 21:34:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 389 ms / 3,000 ms
コード長 888 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 205,112 KB
実行使用メモリ 4,768 KB
最終ジャッジ日時 2023-09-06 18:51:28
合計ジャッジ時間 18,003 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 298 ms
4,768 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 389 ms
4,536 KB
testcase_07 AC 194 ms
4,376 KB
testcase_08 AC 389 ms
4,696 KB
testcase_09 AC 389 ms
4,592 KB
testcase_10 AC 389 ms
4,476 KB
testcase_11 AC 386 ms
4,596 KB
testcase_12 AC 387 ms
4,668 KB
testcase_13 AC 385 ms
4,500 KB
testcase_14 AC 183 ms
4,380 KB
testcase_15 AC 363 ms
4,580 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 10 ms
4,380 KB
testcase_18 AC 140 ms
4,380 KB
testcase_19 AC 306 ms
4,564 KB
testcase_20 AC 120 ms
4,380 KB
testcase_21 AC 115 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

double pi = 3.14159265;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double R;
    int K;
    cin >> R >> K;
    double all = R*R*pi;
    vector<double>ans;
    for(int i = 0; i < K/2; i++) {
        double l = 0,r = R;
        for(int j = 0; j < 100; j++) {
            double mid = (l+r)/2;
            double tmp = 0;
            double a = sqrt(R*R-mid*mid);
            double b = pi-atan2(mid,a)*2;
            tmp += R*R*b/2;
            tmp -= a*mid;
            if(tmp >= all/(K+1)*(i+1)) {
                l = mid;
            }
            else {
                r = mid;
            }
        }
        ans.push_back(l);
        ans.push_back(-l);
    }
    if(K%2) ans.push_back(0);
    sort(ans.begin(),ans.end());
    for(auto i:ans) {
        cout << fixed << setprecision(18) << i << "\n";
    }
}
0