結果

問題 No.2352 Sharpened Knife in Fall
コンテスト
ユーザー umezo
提出日時 2023-06-17 03:01:25
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 256 ms / 3,000 ms
コード長 653 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,142 ms
コンパイル使用メモリ 208,792 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-07-01 08:04:07
合計ジャッジ時間 9,742 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
const double pi=acos(-1);
const double EPS=1e-10;
double r;
bool f(double x,double y){
  if((x*sqrt(r*r-x*x)+r*r*atan(x/sqrt(r*r-x*x)))+pi*r*r/2>y-EPS) return true;
  return false;
}

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int k;
  cin>>r>>k;
  double s=pi*r*r/(k+1);
  for(int i=1;i<=k;i++){
    double ok=r,ng=-r;
    rep(j,100){
      double mid=(ok+ng)/2;
      if(f(mid,(double)s*i)) ok=mid;
      else ng=mid;
    }
    printf("%.20f\n",ok);
  }
    
  return 0;
}
0