結果

問題 No.2352 Sharpened Knife in Fall
ユーザー as277575
提出日時 2023-06-16 23:23:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 520 ms / 3,000 ms
コード長 727 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 115,568 KB
最終ジャッジ日時 2025-02-14 21:37:05
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bit>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
#include <string>

using namespace::std;

double f(double m) {
  return m * sqrt(1 - m * m) + asin(m);
}

int main() {
  ios::sync_with_stdio(false);
  double r;
  int k;
  cin >> r >> k;
  double a = -1; 
  for (int i = 1; i <= k; ++i) {
    double b = 1;
    for (int j = 0; j < 100; ++j) {
      double m = (a + b) / 2;
      if (abs(f(m) - f(-1)) < ((double) M_PI) * i / (k + 1) ) a = m;
      else b = m;
    }
    cout << r * a << endl;
  }
  
  return 0;
}

0