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"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#pragma comment(linker, "/STACK:102400000,102400000")
#define ll long long
#define endl ("\n")
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a,x) memset(a,x,sizeof(a))
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define ft (frist)
#define sd (second)
#define lrt (rt<<1)
#define rrt (rt<<1|1)
using namespace std;
const long long INF = 1e18+1LL;
const int inf = 1e9+1e8;
const int N=1e5+100;
const ll mod=1e9+7;

///AAAA

ll s,v1,v2,t1,t2;
int main(){
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>s>>v1>>v2>>t1>>t2;
    ll k1=t1*2,k2=t2*2;
    k1+=s*v1;
    k2+=s*v2;
    if(k1<k2) cout<<"First\n";
    else if(k1>k2) cout<<"Second\n";
    else cout<<"Friendship\n";
    return 0;
}
时间: 2024-10-25 22:57:56

Codeforces Round #427 A的相关文章

Codeforces Round #427 (Div. 2) C. Star sky(二维前缀和)

题目链接:Codeforces Round #427 (Div. 2) C. Star sky 题意: 在一个二维平面上有n个星星,每个星星有一个初始的亮度,每过去一秒,星星的亮度变化为(s+1)%(c+1). 现在有q个询问,问t秒后一个矩形区域的星星的总亮度为多少. 题解: 由于c不大,将每颗星星按照初始亮点分类,每一类在任意时间的亮度都是相同的,然后对应加一加就行了. 1 #include<bits/stdc++.h> 2 #define RT(l,r) (l+r|l!=r) 3 #de

Codeforces Round #427 (Div. 2) D. Palindromic characteristics(Manacher求回文串)

题目链接:Codeforces Round #427 (Div. 2) D. Palindromic characteristics 题意: 给你一个串,定义k-th回文串,让你求每个k-th的数量. 题解: manacher处理好后做一下dp就行了. 当然也可以直接dp不用manacher. 1 #include<bits/stdc++.h> 2 #define F(i,a,b) for(int i=a;i<=b;++i) 3 using namespace std; 4 5 cons

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 coordinates (xi, yi), a maximum brightness c, equal for all stars, and an initial brightness si (0 ≤ si ≤ c). Over time the stars twinkle. At moment 0 the i-th

Codeforces Round #427 (Div. 2)

B. The number on the board 题意: 有一个数字,它的每个数位上的数字的和不小于等于k.现在他改变了若干位,变成了一个新的数n,问现在的数和原来的数最多有多少位不同. 思路: 如果现在的数字各位数字之和大于等于k,那么它就可能没有被改变. 反之,那么每个数的最大改变量就是9减去这个数,于是把9减去每个数得到的结果从大到小排序,用k减去现在的数位和得到的结果记为kk,遍历一遍差量数组,用kk去减,知道kk小于0跳出. 代码: 1 #include <stdio.h> 2

codeforces round #427 div2

A:读懂题,乘一下判断大小就行了 #include<bits/stdc++.h> using namespace std; int main() { int s, v1, v2, t1, t2; scanf("%d%d%d%d%d", &s, &v1, &v2, &t1, &t2); int ans1 = v1 * s + t1 * 2, ans2 = v2 * s + t2 * 2; if(ans1 == ans2) puts(&q

Codeforces Round #427 C

Star sky 题意:在坐标系上有一些星星,坐标大于1小于100,每颗星星初始亮度为si,每过1s亮度+1,当亮度>c的时候变为0,c<=10,q个询问,求每次在给定的矩形区域内所有星星的亮度 思路:处理出每一个星星每个事件的亮度,然后再对应到坐标(一个坐标可能有多颗星星),处理出x或y轴的前缀和,每次询问对区域内的亮度求和就是 AC代码: #include "iostream" #include "string.h" #include "s

Codeforces Round #427 B

The number on the board 题意:给一个数字,问最少改变多少位可以使得每一位相加大于k 思路:从小的开始改变,每一位变成9,xjb写 AC代码: #include "iostream" #include "string.h" #include "stack" #include "queue" #include "string" #include "vector" #i

Codeforces Round #427 (Div. 2) D. Palindromic characteristics

D. Palindromic characteristics Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes. A string is 1-palindrome if and only if

Codeforces Round #427 (Div. 2) D dp

D. Palindromic characteristics 题意:求给定字符串每阶回文子串有多少个. tags:根本没想到 dp..直接看官方题解吧 dp[i][j] 代表第 i 个字符到第 j 个字符的子串是几阶回文. Solution. Let's calculate the following dp. dp[l][r] is the maximum k such that the substring built from characters from l to r is k-palin