結果
| 問題 |
No.2352 Sharpened Knife in Fall
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2023-07-12 14:43:43 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 953 ms / 3,000 ms |
| コード長 | 1,362 bytes |
| コンパイル時間 | 1,559 ms |
| コンパイル使用メモリ | 141,424 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 04:33:12 |
| 合計ジャッジ時間 | 23,389 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<map>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
using ll = long long;
double calc(double r,double l){
double x = sqrt(r*r-l*l);
double y = l;
double theta = atan2(y,x);
theta = acos(-1)/2 - theta;
double now = r* r;
now *=theta;
now -= x * l;
return now;
}
int main(){
ll r,k;
cin>>r>>k;
vector<double> ans;
double all = acos(-1) * r * r;
double want = all / (double)(k+1);
double use = 0;
double last = r;
//cout<<calc(r,0)<<" "<<want<<endl;
//cout<<calc(r,0.264)<<endl;
for(int i = 0;i<k;i++){
double right = last;
double left = -r;
int q = 100;
while(q--){
double mid = (right+left)/2.;
double now = 0;
now += calc(r,abs(mid));
if(mid>=0) now = now - use;
else now = all - use - now;
if(now>want) left = mid;
else right = mid;
}
// cout<<right<<endl;
ans.push_back(right);
last = right;
use += want;
}
cout<<fixed<<setprecision(30);
sort(ans.begin(),ans.end());
for(int i = 0;i<ans.size();i++) cout<<ans[i]<<endl;
}
momoyuu