A. Key races
Two boys decided to compete in text typing on the site “Key races”. During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The second participant types one character in v2 milliseconds and has ping t2 milliseconds.
If connection ping (delay) is t milliseconds, the competition passes for a participant as follows:
Exactly after t milliseconds after the start of the competition the participant receives the text to be entered.
Right after that he starts to type it.
Exactly t milliseconds after he ends typing all the text, the site receives information about it.
The winner is the participant whose information on the success comes earlier. If the information comes from both participants at the same time, it is considered that there is a draw.
Given the length of the text and the information about participants, determine the result of the game.
Input
The first line contains five integers s, v1, v2, t1, t2 (1 ≤ s, v1, v2, t1, t2 ≤ 1000) — the number of characters in the text, the time of typing one character for the first participant, the time of typing one character for the the second participant, the ping of the first participant and the ping of the second participant.
Output
If the first participant wins, print “First”. If the second participant wins, print “Second”. In case of a draw print “Friendship”.
Examples
input
5 1 2 1 2
output
First
input
3 3 1 1 1
output
Second
input
4 5 3 1 5
output
Friendship
【解题报告】
题意读懂了就很显然了。
果然是自己洋文不好啊
代码如下:
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define LL long long
LL n,t1,t2,v1,v2;
int main()
{
scanf("%lld%lld%lld%lld%lld",&n,&v1,&v2,&t1,&t2);
LL a=t1+v1*n+t1;
LL b=t2+v2*n+t2;
puts(a==b?"Friendship":a<b?"First":"Second");
return 0;
}
本文介绍了一种在线打字比赛的胜负判断逻辑。比赛中两名选手需输入相同字符数的文本,依据各自的输入速度及网络延迟来决定胜负。文章提供了一个简洁的C++代码示例,用于计算每个参赛者完成比赛所需的总时间。
212

被折叠的 条评论
为什么被折叠?



