Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int N = 1010;
- const int oo=0x3f;
- const int mod=1e9+7;
- const int base=311;
- const double EP=1e-9;
- int n,a[N],vb,vs,u,v;
- double kc(int x, int u1, int v1){
- int dx=abs(x-u1);
- int dy=abs(v1);
- return sqrt(dx*dx+dy*dy);
- }
- double f(int x){
- double t1=x/vb;
- double t2=kc(x,u,v)/vs;
- return t1+t2;
- }
- void init(){
- FAST;
- if (fopen(TASK".INP","r")){
- READFILE;
- WRITEFILE;
- }
- cin >> n >> vb >> vs;
- For(i,1,n){
- cin >> a[i];
- }
- cin >> u >> v;
- }
- signed main()
- {
- init();
- pair<double,double> ans;
- ans.fi=ans.se=10000000;
- int id=0;
- For(i,2,n){
- double res=f(a[i]);
- if (ans.fi>res) {
- id=i;
- ans.fi=res;
- ans.se=kc(a[i],u,v);
- } else if (abs(ans.fi-res)<EP) {
- if (ans.se<kc(a[i],u,v)) {
- ans.se=kc(a[i],u,v);
- id=i;
- }
- }
- }
- cout << id;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement