Codeforce 835A - 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:

  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 sv1, 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.

题解:可以说是很水了

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstring>
 4 #include <cstdio>
 5 #include <vector>
 6 #include <cstdlib>
 7 #include <iomanip>
 8 #include <cmath>
 9 #include <ctime>
10 #include <map>
11 #include <set>
12 using namespace std;
13 #define lowbit(x) (x&(-x))
14 #define max(x,y) (x>y?x:y)
15 #define min(x,y) (x<y?x:y)
16 #define MAX 100000000000000000
17 #define MOD 1000000007
18 #define pi acos(-1.0)
19 #define ei exp(1)
20 #define PI 3.141592653589793238462
21 #define INF 0x3f3f3f3f3f
22 #define mem(a) (memset(a,0,sizeof(a)))
23 typedef long long ll;
24 ll gcd(ll a,ll b){
25     return b?gcd(b,a%b):a;
26 }
27 const int N=205;
28 const int mod=1e9+7;
29
30 int main()
31 {
32     std::ios::sync_with_stdio(false);
33     int s,v1,v2,t1,t2;
34     cin>>s>>v1>>v2>>t1>>t2;
35     int s1=s*v1+2*t1;
36     int s2=s*v2+2*t2;
37     if(s1<s2) cout<<"First"<<endl;
38     else if(s1==s2) cout<<"Friendship"<<endl;
39     else cout<<"Second"<<endl;
40     return 0;
41 }

时间: 2024-11-09 00:30:32

Codeforce 835A - Key races的相关文章

Codeforces Round #427 A

Key races 题意: 思路:xjb写 AC代码: #include "iostream" #include "string.h" #include "stack" #include "queue" #include "string" #include "vector" #include "set" #include "map" #includ

Haproxy Configure File

---------------------- HAProxy Configuration Manual ---------------------- version 1.5.11 willy tarreau 2015/02/01 This document covers the configuration language as implemented in the versionspecified above. It does not provide any hint, example or

Python对字典(directory)按key和value排序

distance = {9149: 0, 9150: 26, 9151: 24, 9152: 24, 9153: 24, 9154: 27, 9155: 25, 9156: 30, 9158: 20, 9159: 22, 9160: 25, 9161: 21, 9163: 25, 9164: 23, 9165: 25, 9166: 30, 9167: 20, 9169: 25, 9170: 24, 9171: 23, 9172: 25, 9173: 24, 9174: 29, 9176: 27,

C++ STL中Map的按Key排序和按Value排序

原文  http://blog.csdn.net/iicy266/article/details/11906189 map是用来存放<key, value>键值对的数据结构,可以很方便快速的根据key查到相应的value.假如存储学生和其成绩(假定不存在重名,当然可以对重名加以区分),我们用map来进行存储就是个不错的选择. 我们这样定义,map<string, int>,其中学生姓名用string类型,作为Key:该学生的成绩用int类型,作为value.这样一来,我们可以根据学

Mercedes-Benz NEC BGA 315MHZ 433MHZ 434MHZ GLK GLA GLC ML W204 W207 W212 W221 W222 S300 S350 S400 S500 S550 S600 C180 C200 C260 C300 ES350 GLK300 GLA200 E260L C200 B200 S320L Mercedes-Benz KEY PC

AUTO ECU CHIPS  STOCK ESL Motor  ELV Motor  Steering Lock Wheel Motor for Mercedes-Benz ESL/ELV Motor Steering Lock Wheel Motor for Mercedes-Benz W204 W207 W212 esl motor elv motor Mercedes-Benz NEC   BGA 315MHZ 433MHZ  434MHZ GLK GLA GLC ML W204 W20

ssh无密码登录设置方法以及出现问题 ECDSA host key 和IP地址对应的key不同的解决

最近在做hadoop,因为要求各主机之间的用户必须相同,且为方便远程登录,需配置无密码登录 先附上ssh无密码登录设置方法: 先生成密钥并配置无ssh无密码登录本机,输入命令: ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys 将文件拷贝到其他主机相同的文件夹内,输入命令: scp authorized_keys hostname1:~/.ssh/ scp autho

Android 百度地图开发(一)--- 申请API Key和在项目中显示百度地图

标签: Android百度地图API Key  分类: Android 百度地图开发(2)  最近自己想研究下地图,本来想研究google Map,但是申请API key比较坑爹,于是从百度地图入手,其实他们的用法都差不多,本篇文章就带领大家在自己的Android项目中加入百度地图的功能,接下来我会写一系列关于百度地图的文章,欢迎大家到时候关注!   一 申请API key 在使用百度地图之前,我们必须去申请一个百度地图的API key,申请地址http://lbsyun.baidu.com/a

KEY操作续

[KEY操作续] 1.UMP key 序列化给定 key ,并返回被序列化的值,使用 RESTORE 命令可以将这个值反序列化为 Redis 键. 序列化生成的值有以下几个特点: 它带有 64 位的校验和,用于检测错误, RESTORE 在进行反序列化之前会先检查校验和. 序列化的值不包括任何生存时间信息. 返回值: 如果 key 不存在,那么返回 nil . 否则,返回序列化之后的值. 2.FLUSHDB 清空当前数据库中的所有 key. 此命令从不失败. 3.DBSIZE 返回当前数据库的

.plist 中各个key的含义

.plist [html] view plaincopyprint? <EMBED id=ZeroClipboardMovie_1 height=14 name=ZeroClipboardMovie_1 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=29 src=http://static.blog.csdn.net/scr