问题描述:
两位赛车手LEO和MARS按以下的约定来进行N(N为奇数)局比赛:
⑴在长度为L米的跑道上比赛;
⑵LEO从跑道起点起步,MARS从距离起点W米的地点同时起步,一齐向终点进发;
⑶若LEO能在到达终点前赶上MARS,则该局LEO获胜,否则MARS获胜;
⑷获胜局数多者为本次比赛的最终胜利者,
假设N、L、W均为整数,并分别用V1和V2表示LEO和MARS的赛车速度。让你当本次赛车的裁判,你能告诉大家最终的胜利者吗?
输入格式:
第一行输入N、L、W的值;
第二行输入第一局比赛V1和V2的值;( V1、V2均是实数)
后面N-1行分别输入第二局至第N局比赛V1和V2的值。
输出格式:
第一行输出LEO获胜的局数;
第二行输出MARS获胜的局数;
第三行输出最终胜利者的姓名。
输入样例1:
1 1000 200
12 10
输出样例1:
0
1
MARS
输入样例2:
3 1000 200
12.5 10
11 12
11 9
输出样例2:
1
2
MARS
输入样例3:
5 1000 200
12.5 10
11 12
11 9
13.5 10
12 8
输出样例3:
3
2
LEO
数据范围:
对于100%的数据,N<10^6,0<=W<L<=10^9,0<=V1,V2<=10^5。
90 Wrong Answer
# 状态 分数 耗时 内存占用
#0 Accepted 10 2ms 384 KiB
#1 Accepted 10 2ms 384 KiB
#2 Accepted 10 7ms 384 KiB
#3 Accepted 10 14ms 384 KiB
#4 Wrong Answer 0 2ms 384 KiB
#5 Accepted 10 32ms 384 KiB
#6 Accepted 10 43ms 384 KiB
#7 Accepted 10 39ms 440 KiB
#8 Accepted 10 628ms 416 KiB
#9 Accepted 10 623ms 408 KiB
#include <bits/stdc++.h>
using namespace std;
int n,leo,mars;
double x,y,s,b;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
cin>>n>>x>>y;
for(int i=1;i<=n;i++)
{
cin>>s>>b;
double k=y/(s-b);
if(b>=s)mars++;
else if(k>(x-y)/b)mars++;
else leo++;
//cout<<endl<<endl<<endl<<endl<<y/(s-b)<<endl<<endl<<endl<<x/b;
}
cout<<leo<<endl<<mars<<endl;
if(leo>mars)
{
cout<<"LEO";
}
else cout<<"MARS";
return 0;
}
aaaaaa
回答必关