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
inputCopy
5 1 2 1 2
outputCopy
First
inputCopy
3 3 1 1 1
outputCopy
Second
inputCopy
4 5 3 1 5
outputCopy
Friendship
Note
In the first example, information on the success of the first participant comes in 7 milliseconds, of the second participant — in 14 milliseconds. So, the first wins.

In the second example, information on the success of the first participant comes in 11 milliseconds, of the second participant — in 5 milliseconds. So, the second wins.

In the third example, information on the success of the first participant comes in 22 milliseconds, of the second participant — in 22 milliseconds. So, it is be a draw.
大意:俩人比赛(网络有延迟)时间为各自的 t ,t 的意思(比赛开始计时,t毫秒后才收到题目,打完字后立刻上交, t 毫秒后裁判才收到你的提交)
比赛给出 s 个字符,第一个人打一个字符用 v1 毫秒,第二个人…
注意:是打一个字用 v 毫秒,不是1毫秒能打 v 个字!!!

#include <iostream>
using namespace std;

int main()
{
    int s, v1, v2, t1, t2;
    while(cin >> s >> v1 >> v2 >> t1 >> t2)
    {
        int sum1 = 2 * t1 + s * v1;
        int sum2 = 2 * t2 + s * v2;
        if(sum1 < sum2)
            cout << "First" << '\n';
        else if(sum1 > sum2)
            cout << "Second" << '\n';
        else
            cout << "Friendship" << '\n';
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/zhaobaole2018/article/details/85291951
key