結果

問題 No.2352 Sharpened Knife in Fall
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-16 22:07:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,450 bytes
コンパイル時間 2,658 ms
コンパイル使用メモリ 111,140 KB
実行使用メモリ 5,644 KB
最終ジャッジ日時 2023-09-06 20:02:39
合計ジャッジ時間 14,321 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 798 ms
5,328 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 757 ms
5,332 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 634 ms
5,644 KB
testcase_20 AC 247 ms
4,380 KB
testcase_21 AC 234 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    long double R, pi=M_PI, S, T, U;
    int K;
    cin >> R >> K;
    S = pi*R*R / (long double) (K+1);
    vector<long double> v;

    long double l, r, c;

    if (K % 2 == 0){
        T = 0;
        for (int i=0; i<K/2; i++){
            l = 0, r = pi/2;
            for (int j=0; j<100; j++){
                c = (r+l)/2;
                U = (c * R * R + R * R * sin(c) * cos(c)) * 2 - T;
                if (U <= S) l=c;
                else r=c;
            }
            v.push_back(R*sin(l));
            v.push_back(-R*sin(l));
            T = (c * R * R + R * R * sin(c) * cos(c)) * 2;
        }
    }
    else{
        v.push_back(0);
        T = 0;
        for (int i=0; i<K/2; i++){
            l = 0, r = pi/2;
            for (int j=0; j<100; j++){
                c = (r+l)/2;
                U = c * R * R + R * R * sin(c) * cos(c) - T;
                if (U <= S) l=c;
                else r=c;
            }
            v.push_back(R*sin(l));
            v.push_back(-R*sin(l));
            T = c * R * R + R * R * sin(c) * cos(c);
        }
    }

    sort(v.begin(), v.end());
    for (auto x : v) cout << setprecision(18) << x << endl;

    return 0;
}
0