提出 #485279


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
const double eps = 1e-8;
int main(){
	double x,y,O,w;
	scanf("%lf%lf%lf%lf",&x,&y,&O,&w);
	O = O / 180.0 * pi;
	w = w / 180.0 * pi;
	double theta = atan2(y,x);
	//printf("%.f\n",theta*180/pi);
	if(theta<eps)theta+=2*pi;
	double d = sqrt(x*x+y*y);
	double sx=cos(O),sy=sin(O);

	double l = 0.0,r = w*d;
	while(r-l>eps){
		double mid = (l+r)/2;
		double ra = mid / w;
		double t = sqrt(d*d-ra*ra);
		double myt = t / mid;
		double a = acos((d*d+ra*ra-t*t)/2.0/d/ra);
		double a1=theta+a,a2=theta-a;
		if(a1>2*pi)a1-=2*pi;
		if(a2<0)a2+=2*pi;
		
		double mx=cos(a1),my=sin(a1);
		if((sx*y-sy*x)*(sx*my-sy*mx)<eps)a1=-1.0;
		else {
			a1=fabs(a1-O);
			a1=min(a1,2*pi-a1);
		}

		mx=cos(a2),my=sin(a2);
		if((sx*y-sy*x)*(sx*my-sy*mx)<eps)a2=-1.0;
		else {
			a2=fabs(a2-O);
			a2=min(a2,2*pi-a2);
		}
		if(a1<0&&a2<0){
			r=mid;
			continue;
		}
		double st = max(a1,a2);
		st = st / w;
		if(st+eps<myt)l=mid;
		else r=mid;
	}
	printf("%.8f\n",l);
	return 0;
}

提出情報

提出日時
問題 K - Runner and Sniper
ユーザ NCTU_Thor
言語 C++11 (GCC 4.9.2)
得点 0
コード長 1084 Byte
結果 WA
実行時間 29 ms
メモリ 928 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lf%lf%lf%lf",&x,&y,&O,&w);
                                   ^

ジャッジ結果

セット名 All
得点 / 配点 0 / 100
結果
AC × 29
WA × 20
セット名 テストケース
All 00_sample_00, 10_rand_00, 10_rand_01, 10_rand_02, 10_rand_03, 10_rand_04, 10_rand_05, 10_rand_06, 10_rand_07, 10_rand_08, 10_rand_09, 10_rand_10, 10_rand_11, 10_rand_12, 10_rand_13, 10_rand_14, 10_rand_15, 10_rand_16, 10_rand_17, 10_rand_18, 10_rand_19, 10_rand_20, 10_rand_21, 10_rand_22, 10_rand_23, 10_rand_24, 10_rand_25, 10_rand_26, 10_rand_27, 10_rand_28, 10_rand_29, 80_exact_00, 80_exact_01, 80_exact_02, 80_exact_03, 80_exact_04, 80_exact_05, 80_exact_06, 80_exact_07, 80_exact_08, 80_exact_09, 80_exact_10, 80_exact_11, 80_exact_12, 80_exact_13, 80_exact_14, 80_exact_15, 90_min_00, 95_max_00
ケース名 結果 実行時間 メモリ
00_sample_00 AC 27 ms 792 KiB
10_rand_00 WA 25 ms 920 KiB
10_rand_01 WA 26 ms 920 KiB
10_rand_02 AC 27 ms 924 KiB
10_rand_03 AC 26 ms 792 KiB
10_rand_04 AC 26 ms 792 KiB
10_rand_05 AC 26 ms 916 KiB
10_rand_06 AC 26 ms 788 KiB
10_rand_07 WA 25 ms 788 KiB
10_rand_08 AC 27 ms 804 KiB
10_rand_09 WA 26 ms 672 KiB
10_rand_10 AC 26 ms 792 KiB
10_rand_11 AC 26 ms 800 KiB
10_rand_12 WA 26 ms 928 KiB
10_rand_13 WA 27 ms 912 KiB
10_rand_14 WA 27 ms 668 KiB
10_rand_15 AC 28 ms 800 KiB
10_rand_16 WA 27 ms 748 KiB
10_rand_17 AC 27 ms 916 KiB
10_rand_18 AC 28 ms 924 KiB
10_rand_19 AC 28 ms 920 KiB
10_rand_20 WA 27 ms 804 KiB
10_rand_21 AC 28 ms 920 KiB
10_rand_22 AC 26 ms 920 KiB
10_rand_23 AC 26 ms 916 KiB
10_rand_24 AC 26 ms 800 KiB
10_rand_25 AC 26 ms 924 KiB
10_rand_26 AC 24 ms 804 KiB
10_rand_27 WA 26 ms 796 KiB
10_rand_28 WA 26 ms 924 KiB
10_rand_29 AC 26 ms 796 KiB
80_exact_00 AC 26 ms 920 KiB
80_exact_01 WA 25 ms 916 KiB
80_exact_02 AC 27 ms 800 KiB
80_exact_03 AC 25 ms 924 KiB
80_exact_04 AC 29 ms 792 KiB
80_exact_05 WA 25 ms 920 KiB
80_exact_06 WA 27 ms 744 KiB
80_exact_07 AC 26 ms 672 KiB
80_exact_08 AC 25 ms 796 KiB
80_exact_09 AC 27 ms 792 KiB
80_exact_10 WA 28 ms 800 KiB
80_exact_11 AC 27 ms 920 KiB
80_exact_12 WA 27 ms 792 KiB
80_exact_13 WA 27 ms 796 KiB
80_exact_14 WA 27 ms 800 KiB
80_exact_15 WA 27 ms 800 KiB
90_min_00 WA 26 ms 924 KiB
95_max_00 AC 27 ms 912 KiB