Codeforces Round #427 (Div. 2) Problem A Key races (Codeforces 835 A)

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:

  1. Exactly after t milliseconds after the start of the competition the participant receives the text to be entered.
  2. Right after that he starts to type it.
  3. 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 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.


  题目大意 两个人开始打字游戏,每个人有一个速度,以及发送打字的文本串和提交文本串会有一个延时。问谁会赢。

  按照题目意思,算出运营商收到两人的提交文本最少要耗的时间。

Code

 1 /**
 2  * Codeforces
 3  * Problem#835A
 4  * Accepted
 5  * Time:30ms
 6  * Memory:2100k
 7  */ 
 8 #include <bits/stdc++.h> 
 9 #ifndef WIN32
10 #define Auto "%lld"
11 #else
12 #define Auto "%I64d"
13 #endif
14 using namespace std;
15 typedef bool boolean;
16 const signed int inf = (signed)((1u << 31) - 1);
17 const signed long long llf = (signed long long)((1ull << 61) - 1);
18 const double eps = 1e-6;
19 const int binary_limit = 128;
20 #define smin(a, b) a = min(a, b)
21 #define smax(a, b) a = max(a, b)
22 #define max3(a, b, c) max(a, max(b, c))
23 #define min3(a, b, c) min(a, min(b, c))
24 template<typename T>
25 inline boolean readInteger(T& u){
26     char x;
27     int aFlag = 1;
28     while(!isdigit((x = getchar())) && x != '-' && x != -1);
29     if(x == -1) {
30         ungetc(x, stdin);    
31         return false;
32     }
33     if(x == '-'){
34         x = getchar();
35         aFlag = -1;
36     }
37     for(u = x - '0'; isdigit((x = getchar())); u = (u << 1) + (u << 3) + x - '0');
38     ungetc(x, stdin);
39     u *= aFlag;
40     return true;
41 }
42 
43 int s, v0, v1, t0, t1;
44 
45 inline void init() {
46     scanf("%d%d%d%d%d", &s, &v0, &v1, &t0, &t1);
47 }
48 
49 inline void solve() {
50     int a = 2 * t0 + s * v0;
51     int b = 2 * t1 + s * v1;
52     if(a > b)
53         puts("Second");
54     else if(a < b)
55         puts("First");
56     else
57         puts("Friendship");
58 }
59 
60 int main() {
61     init();
62     solve();
63     return 0;
64 }

 

转载于:https://www.cnblogs.com/yyf0309/p/7266703.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
校园悬赏任务平台对字典管理、论坛管理、任务资讯任务资讯公告管理、接取用户管理、任务管理、任务咨询管理、任务收藏管理、任务评价管理、任务订单管理、发布用户管理、管理员管理等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择小程序模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行校园悬赏任务平台程序的开发,在数据库的选择上面,选择功能强大的Mysql数据库进行数据的存放操作。校园悬赏任务平台的开发让用户查看任务信息变得容易,让管理员高效管理任务信息。 校园悬赏任务平台具有管理员角色,用户角色,这几个操作权限。 校园悬赏任务平台针对管理员设置的功能有:添加并管理各种类型信息,管理用户账户信息,管理任务信息,管理任务资讯公告信息等内容。 校园悬赏任务平台针对用户设置的功能有:查看并修改个人信息,查看任务信息,查看任务资讯公告信息等内容。 系统登录功能是程序必不可少的功能,在登录页面必填的数据有两项,一项就是账号,另一项数据就是密码,当管理员正确填写并提交这二者数据之后,管理员就可以进入系统后台功能操作区。项目管理页面提供的功能操作有:查看任务,删除任务操作,新增任务操作,修改任务操作。任务资讯公告信息管理页面提供的功能操作有:新增任务资讯公告,修改任务资讯公告,删除任务资讯公告操作。任务资讯公告类型管理页面显示所有任务资讯公告类型,在此页面既可以让管理员添加新的任务资讯公告信息类型,也能对已有的任务资讯公告类型信息执行编辑更新,失效的任务资讯公告类型信息也能让管理员快速删除。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值