結果

問題 No.2352 Sharpened Knife in Fall
ユーザー 沙耶花沙耶花
提出日時 2023-06-16 21:29:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 961 bytes
コンパイル時間 4,230 ms
コンパイル使用メモリ 263,376 KB
実行使用メモリ 4,828 KB
最終ジャッジ日時 2023-09-06 18:42:45
合計ジャッジ時間 15,284 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 322 ms
4,560 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 386 ms
4,532 KB
testcase_07 AC 197 ms
4,380 KB
testcase_08 AC 394 ms
4,676 KB
testcase_09 WA -
testcase_10 AC 387 ms
4,560 KB
testcase_11 AC 387 ms
4,528 KB
testcase_12 AC 382 ms
4,576 KB
testcase_13 AC 392 ms
4,508 KB
testcase_14 AC 185 ms
4,384 KB
testcase_15 WA -
testcase_16 AC 21 ms
4,384 KB
testcase_17 AC 10 ms
4,380 KB
testcase_18 AC 140 ms
4,384 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

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;

double get(double h){
	double r = R;
	return r * r * acos(1.0 - h/r) - (r-h) * sqrt(2.0 * r * h - h*h);
}

int main(){
	double pi = acos(-1.0);
	
	cin>>R>>K;
	
	double S = R;
	S *= R;
	S *= pi;
	
	S /= K+1;
	
	vector<double> ans;
	double last = 0.0;
	rep(i,1000000){
		double ok = last,ng = 2.0*R;
		rep(_,50){
			double mid = (ok+ng)/2.0;
			if(get(mid)-get(last)<=S)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(ans.size()!=K)ans.push_back(0.0);
	sort(ans.begin(),ans.end());
	
	rep(i,K){
		cout<<fixed<<setprecision(10)<<ans[i]<<endl;
	}
	
	//cout<<ans.size()<<endl;
	return 0;
}
0