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:
- 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 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
/**
* Codeforces
* Problem#835A
* Accepted
* Time:30ms
* Memory:2100k
*/
#include <bits/stdc++.h>
#ifndef WIN32
#define Auto "%lld"
#else
#define Auto "%I64d"
#endif
using namespace std;
typedef bool boolean;
const signed int inf = (signed)((1u << ) - );
const signed long long llf = (signed long long)((1ull << ) - );
const double eps = 1e-;
const int binary_limit = ;
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
template<typename T>
inline boolean readInteger(T& u){
char x;
int aFlag = ;
while(!isdigit((x = getchar())) && x != '-' && x != -);
if(x == -) {
ungetc(x, stdin);
return false;
}
if(x == '-'){
x = getchar();
aFlag = -;
}
for(u = x - ''; isdigit((x = getchar())); u = (u << ) + (u << ) + x - '');
ungetc(x, stdin);
u *= aFlag;
return true;
} int s, v0, v1, t0, t1; inline void init() {
scanf("%d%d%d%d%d", &s, &v0, &v1, &t0, &t1);
} inline void solve() {
int a = * t0 + s * v0;
int b = * t1 + s * v1;
if(a > b)
puts("Second");
else if(a < b)
puts("First");
else
puts("Friendship");
} int main() {
init();
solve();
return ;
}
Codeforces Round #427 (Div. 2) Problem A Key races (Codeforces 835 A)的更多相关文章
- Codeforces Round #427 (Div. 2) Problem D Palindromic characteristics (Codeforces 835D) - 记忆化搜索
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th nu ...
- Codeforces Round #427 (Div. 2) Problem C Star sky (Codeforces 835C) - 前缀和
The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinat ...
- 【Codeforces Round #427 (Div. 2) A】Key races
[Link]:http://codeforces.com/contest/835/problem/A [Description] [Solution] 傻逼题. [NumberOf WA] [Revi ...
- Codeforces Round #427 (Div. 2) Problem B The number on the board (Codeforces 835B) - 贪心
Some natural number was written on the board. Its sum of digits was not less than k. But you were di ...
- Codeforces Round #425 (Div. 2) Problem C Strange Radiation (Codeforces 832C) - 二分答案 - 数论
n people are standing on a coordinate axis in points with positive integer coordinates strictly less ...
- CodeForces 835C - Star sky | Codeforces Round #427 (Div. 2)
s <= c是最骚的,数组在那一维开了10,第八组样例直接爆了- - /* CodeForces 835C - Star sky [ 前缀和,容斥 ] | Codeforces Round #4 ...
- CodeForces 835D - Palindromic characteristics | Codeforces Round #427 (Div. 2)
证明在Tutorial的评论版里 /* CodeForces 835D - Palindromic characteristics [ 分析,DP ] | Codeforces Round #427 ...
- Codeforces Round #716 (Div. 2), problem: (B) AND 0, Sum Big位运算思维
& -- 位运算之一,有0则0 原题链接 Problem - 1514B - Codeforces 题目 Example input 2 2 2 100000 20 output 4 2267 ...
- Codeforces Round #427 (Div. 2)—A,B,C,D题
A. Key races 题目链接:http://codeforces.com/contest/835/problem/A 题目意思:两个比赛打字,每个人有两个参数v和t,v秒表示他打每个字需要多久时 ...
随机推荐
- 判断数组对象里面的某个属性全部为true才执行下一步操作
比如数据[ {name:'张三',isshow:'false'},name:'李四',isshow:'false'}, ] 这里是自己写的验证,没用elemten的 如果有2张票,需要刷2张身份证,则 ...
- Selenium基础知识(十)截屏
自动化测试过程中,经常会用截图的方式,更直观的显示展示错误信息:selenium截图的三种方式: driver.get_screenshot_as_file(r'd:\selenium.png') # ...
- C# 深拷贝和浅拷贝
在编码中.经常会遇到赋值操作.值类型就不说了.如果是引用类型赋值.其实是引用传递,即赋值的是一个引用.比如: Person p1 = new Person("张三", " ...
- SwingBench 字符模式压测最佳实践
之前写过<使用SwingBench 对Oracle RAC DB性能 压力测试>,使用的是最基础直观的图形模式,已经可以满足大多数需求. 但是在有些场景下,图形模式可能本身消耗资源过大,尤 ...
- sqli-labs(十六)(order by注入)
第四十六关: http://www.bubuko.com/infodetail-2481914.html 这有篇文章讲得还不错可以看下 这关是order by后面的一个注入,用报错注入和盲注都是可以的 ...
- LeetCode11.盛最多水的容器
给定 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) .在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0).找出其中的两条线, ...
- Java包装
public class Test2 { public static void main(String[] args) { /*String str = "..............&qu ...
- python subprocess中ssh命令的特殊性
今天尝试使用python 的 subprocess 模块 使用类似如下语句: p=subprocess.Popen(['ssh','root@localhost'],stdout=subprocess ...
- Unity shader学习之逐像素漫反射光照模型
shader如下: Shader "Custom/Diffuse Fragment-Level" { Properties { _Diffuse (,,,) } SubShader ...
- SQLSetConnectAttr
SQLSetConnectAttr 函数定义: 用法类似于SQLSetEnvAttr,该函数是设置连接的各项属性用的 SQLRETURN SQLSetConnectAttr( SQLHDBC ...