結果

問題 No.2352 Sharpened Knife in Fall
ユーザー kumakumakumakuma
提出日時 2023-05-13 22:47:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 349 ms / 3,000 ms
コード長 1,205 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 203,752 KB
実行使用メモリ 5,280 KB
最終ジャッジ日時 2023-08-19 19:00:30
合計ジャッジ時間 15,201 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 184 ms
5,280 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 346 ms
5,228 KB
testcase_07 AC 172 ms
4,380 KB
testcase_08 AC 349 ms
5,228 KB
testcase_09 AC 347 ms
5,224 KB
testcase_10 AC 346 ms
5,168 KB
testcase_11 AC 342 ms
5,196 KB
testcase_12 AC 341 ms
5,280 KB
testcase_13 AC 341 ms
5,276 KB
testcase_14 AC 154 ms
4,384 KB
testcase_15 AC 312 ms
5,168 KB
testcase_16 AC 18 ms
4,384 KB
testcase_17 AC 10 ms
4,388 KB
testcase_18 AC 126 ms
4,380 KB
testcase_19 AC 278 ms
5,228 KB
testcase_20 AC 105 ms
4,380 KB
testcase_21 AC 104 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI = 3.141592653589793238462643383279;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll R, K;
  cin >> R >> K;
  ld S = R * R * PI;
  vector<ld> ans;
  for (ll i = 0; i < K / 2; ++i) {
    ld want_s = (i + 1) * S / (ld)(K + 1);
    ld l = 0, r = R;
    while (l + 0.0000001 <= r) {
      ld m = (l + r) / 2;
      ld half_sita = acosl(m / R);
      ld s = R * R * half_sita - m * sqrtl(R * R - m * m);
      if (s <= want_s) {
        r = m;
      }
      else {
        l = m;
      }
    }
    ans.push_back(r);
    ans.push_back(-r);
  }
  if (K % 2 == 1) {
    ans.push_back(0);
  }
  sort(rng(ans));
  cout << fixed << setprecision(15);
  for (ll i = 0; i < ans.size(); ++i) {
    cout << ans.at(i) << "\n";
  }
}
0