結果

問題 No.948 Bomb vs Dush
ユーザー ningenMeningenMe
提出日時 2019-11-22 14:13:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 1,446 ms
コンパイル使用メモリ 164,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 11:26:56
合計ジャッジ時間 13,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
4,380 KB
testcase_01 AC 221 ms
4,376 KB
testcase_02 AC 218 ms
4,380 KB
testcase_03 AC 243 ms
4,380 KB
testcase_04 AC 243 ms
4,376 KB
testcase_05 AC 217 ms
4,376 KB
testcase_06 AC 243 ms
4,376 KB
testcase_07 AC 243 ms
4,380 KB
testcase_08 AC 244 ms
4,376 KB
testcase_09 AC 217 ms
4,376 KB
testcase_10 AC 243 ms
4,380 KB
testcase_11 AC 217 ms
4,376 KB
testcase_12 AC 244 ms
4,380 KB
testcase_13 AC 250 ms
4,380 KB
testcase_14 AC 242 ms
4,376 KB
testcase_15 AC 243 ms
4,380 KB
testcase_16 AC 221 ms
4,380 KB
testcase_17 AC 243 ms
4,376 KB
testcase_18 AC 249 ms
4,380 KB
testcase_19 AC 250 ms
4,376 KB
testcase_20 AC 217 ms
4,376 KB
testcase_21 AC 248 ms
4,376 KB
testcase_22 AC 221 ms
4,376 KB
testcase_23 AC 251 ms
4,376 KB
testcase_24 AC 242 ms
4,380 KB
testcase_25 AC 220 ms
4,380 KB
testcase_26 AC 249 ms
4,376 KB
testcase_27 AC 250 ms
4,380 KB
testcase_28 AC 243 ms
4,376 KB
testcase_29 AC 243 ms
4,376 KB
testcase_30 AC 220 ms
4,376 KB
testcase_31 AC 249 ms
4,380 KB
testcase_32 AC 242 ms
4,376 KB
testcase_33 AC 250 ms
4,380 KB
testcase_34 AC 250 ms
4,380 KB
testcase_35 AC 249 ms
4,380 KB
testcase_36 AC 242 ms
4,380 KB
testcase_37 AC 249 ms
4,376 KB
testcase_38 AC 249 ms
4,376 KB
testcase_39 AC 242 ms
4,380 KB
testcase_40 AC 221 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
constexpr long double PI = 3.1415926535897932384626433;
//Euclidean distance
template<class T> T EucDist(T x1, T y1, T x2, T y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

int main() {
	double r,R,ok = 180., ng = 360., md,x,y,d;
    cin >> r >> R;
	for(int i = 0; i < 1000000; ++i){
		md = (ok+ng)/2.;
		x = R*cos(md/180.*PI);
		y = R*sin(md/180.*PI);
		d = EucDist(x,y,R,0.);
		(2*r<=d?ok:ng)=md;
	}
	double area = PI*((R+r)*(R+r)-(R-r)*(R-r))*ok/360. + PI*r*r;
	double t = PI*ok/180.;
	printf("%.10f\n",t);
	printf("%.10f\n",area);
}
0