Codeforces 835A-Key races
2017-08-01 10:56
369 查看
Key races
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
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
output
input
output
input
output
Note
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 <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
#define LL long long
const int INF = 0x3f3f3f3f;
int s, t1, v1, t2, v2;
int main()
{
while (~scanf("%d%d%d%d%d", &s, &v1, &v2, &t1, &t2))
{
int x = s*v1 + 2 * t1;
int y = s*v2 + 2 * t2;
if (x < y) printf("First\n");
else if (x > y) printf("Second\n");
else printf("Friendship\n");
}
return 0;
}
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
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
Note
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 <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
#define LL long long
const int INF = 0x3f3f3f3f;
int s, t1, v1, t2, v2;
int main()
{
while (~scanf("%d%d%d%d%d", &s, &v1, &v2, &t1, &t2))
{
int x = s*v1 + 2 * t1;
int y = s*v2 + 2 * t2;
if (x < y) printf("First\n");
else if (x > y) printf("Second\n");
else printf("Friendship\n");
}
return 0;
}
相关文章推荐
- codeforces 835A Key races
- CodeForces - 835A Key races(阅读题)
- Codeforces 835A Key races (水题)
- codeforces 835a 之 Key races
- CodeForces 835A Key races
- Codeforces Round #427 (Div. 2) Problem A Key races (Codeforces 835 A)
- CodeForces 835 A.Key races(水~)
- CodeForces 367B Sereja ans Anagrams (map)
- 【CodeForces】841D. Leha and another game about graph(Codeforces Round #429 (Div. 2))
- 树形DP 统计树中长度为K的路径数量 CodeForces 161D Distance in Tree
- Codeforces 546E Soldier and Traveling (最大流)
- CodeForces 610A Pasha and Stick (水)
- Codeforces 189A. Cut Ribbon
- Codeforces 689D Friends and Subsequences【思维+二分+RMQ】套路题
- CodeForces 429B Working out(dp,四个角递推)
- Codeforces 193 Div 2
- Codeforces 552D Vanya and Triangles
- CodeForces 25C(Floyed 最短路)
- CodeForces 292D Connected Components (并查集+YY)
- CodeForces 498D Traffic Jams in the Land