bzoj3695 滑行 - ShinriiTin's Blog - 博主是sb
codeforces 372D Choosing Subtree is Fun
hdu4969 Just a Joke

bzoj3695 滑行

ShinriiTin posted @ 2015年6月11日 18:43 in 未分类 with tags 物理 , 1579 阅读

有个东西叫光路最速。。。

所以我们二分出射角度,由折射定律算出入射位置验证。

Portal

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define eps 1e-6
using namespace std;

const int MAXN=105;
typedef double db;
const db pi=acos(-1.);

int n;

db x,ans,h[MAXN],v[MAXN];

inline db check(db t){
	db x=0,y;ans=0;
	for(int i=1;i<=n;++i){
		y=h[i]*tan(t);
		x+=y;
		ans+=sqrt(h[i]*h[i]+y*y)/v[i];
		if(i<n)t=asin(v[i+1]*sin(t)/v[i]);
	}
	return x;
}

int main(){
	scanf("%d%lf",&n,&x);
	for(int i=n;i;--i)scanf("%lf",h+i);
	for(int i=n;i;--i)scanf("%lf",v+i);
	db l=0,r=pi/2.;
	for(int i=0;i<50;++i){
		db mid=(l+r)/2.;
		if(check(mid)>x)r=mid;
		else l=mid;
	}
	printf("%.3f\n",ans); 
	return 0;
}
 
Avatar_small
K2 Chalan 说:
2022年8月06日 21:32

K2 challan also referred to as Khajane 2, an integrated financial management system from the Government of Karnataka. The K2 has been brought into working with an aim to manage the financial business of the government. <a href="https://25penny.com/k2-challan-karnataka-khazane-login-search/">K2 Chalan</a> It works to simplify the process of remittance of departments under government by bringing an option of anywhere-anytime payment options. Firstly every department under the government of Karnataka will have access to Khajane 2 which allows their customers to remit to the government through the easy payment links provided.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter