結果

問題 No.2352 Sharpened Knife in Fall
ユーザー 沙耶花沙耶花
提出日時 2023-06-16 21:40:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 544 ms / 3,000 ms
コード長 1,245 bytes
コンパイル時間 5,980 ms
コンパイル使用メモリ 263,488 KB
実行使用メモリ 7,928 KB
最終ジャッジ日時 2023-09-06 19:04:07
合計ジャッジ時間 17,121 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 457 ms
7,788 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 533 ms
7,928 KB
testcase_07 AC 269 ms
5,476 KB
testcase_08 AC 544 ms
7,844 KB
testcase_09 AC 543 ms
7,840 KB
testcase_10 AC 535 ms
7,836 KB
testcase_11 AC 537 ms
7,844 KB
testcase_12 AC 534 ms
7,792 KB
testcase_13 AC 535 ms
7,832 KB
testcase_14 AC 249 ms
5,480 KB
testcase_15 AC 503 ms
7,692 KB
testcase_16 AC 27 ms
4,380 KB
testcase_17 AC 13 ms
4,384 KB
testcase_18 AC 192 ms
5,224 KB
testcase_19 AC 413 ms
7,308 KB
testcase_20 AC 164 ms
4,452 KB
testcase_21 AC 154 ms
4,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

long long R,K;

long double get(long double h){
	long double r = R;
	return r * r * acosl(1.0 - h/r) - (r-h) * sqrtl(2.0 * r * h - h*h);
}

int main(){
	long double pi = acosl(-1.0);
	
	cin>>R>>K;
	
	long double S = R;
	S *= R;
	S *= pi;
	
	S /= K+1;
	
	vector<long double> ans;
	long double last = 0.0;
	rep(i,1000000){
		long double ok = last,ng = 2.0*R;
		rep(_,50){
			long double mid = (ok+ng)/2.0;
			if(get(mid)<=S*(i+1))ok = mid;
			else ng = mid;
		}
		if(ok >= R-1e-10)break;
		ans.push_back(-R + ok);
		last = ok;
	}
	int t = ans.size();
	rep(i,t)ans.push_back(-ans[i]);
	if(K%2==1)ans.push_back(0.0);
	sort(ans.begin(),ans.end());
	vector<long double> ta;
	rep(i,ans.size()){
		if(ta.size()>0 && abs(ans[i]-ta.back())<1e-11)continue;
		ta.push_back(ans[i]);
	}
	swap(ans,ta);
	//cout<<ans.size()<<endl;
//cout<<fixed<<setprecision(10)<<ans[K/2]<<','<<ans[K/2+1]<<endl;
	
	rep(i,ans.size()){
		cout<<fixed<<setprecision(10)<<ans[i]<<endl;
	}
	
	//cout<<ans.size()<<endl;
	return 0;
}
0