A. Key races
来源:互联网 发布:大数据分析师工资 编辑:程序博客网 时间:2024/06/05 16:58
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of scharacters. 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.
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.
If the first participant wins, print "First". If the second participant wins, print "Second". In case of a draw print "Friendship".
5 1 2 1 2
First
3 3 1 1 1
Second
4 5 3 1 5
Friendship
In the first example, information on the success of the first participant comes in 7 milliseconds, of the second participant — in 14milliseconds. 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 5milliseconds. 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 22milliseconds. So, it is be a draw.
解题说明:此题是一道模拟题,按照题目要求计算出时间进行比较即可。
#include<cstdio>#include<algorithm>#include<cstring>#include<cstdlib>#include<iostream>using namespace std;int main(){int s,v1,v2,t1,t2,r,p;scanf("%d%d%d%d%d",&s,&v1,&v2,&t1,&t2);r = (s*v1)+t1+t1;p = (s*v2)+t2+t2;if(r<p){printf("First\n");}else if(p<r){printf("Second\n");}else {printf("Friendship\n");}return 0;}
- codeforces A. Key races
- A. Key races
- Codeforces 835A-Key races
- Codeforces 835 A Key races
- CodeForces 835A Key races
- codeforces 835 a Key races
- cf427(2) A. Key races
- codeforces 835A Key races
- Codeforces #835A: Key Races 题解
- Codeforces Round #427 A. Key races
- CodeForces 835 A.Key races(水~)
- Codeforces 835A Key races (水题)
- codeforces 835a 之 Key races
- Key races
- Codeforces Round #427 (Div. 2) A. Key races
- Codeforces Round #427 (Div. 2)-A. Key races
- Codeforces Round #427 (Div. 2) A. Key races
- CF835A-Key races
- HBase启动时util.NativeCodeLoader错误
- 2017-8-7
- 算法:寻找树中两个结点的最低公共祖先
- 存取数据库图片
- 布隆过滤器
- A. Key races
- JavaScript(7)__Js基础<构造>
- lamda表达式
- linux下date命令用法
- hdu 1698 Just a Hook
- I
- C++调用构造函数过程
- 排序算法之选择排序
- java测试