Input The first line of the input contains two integers nn and cc (2≤n≤2⋅105,1≤c≤10002≤n≤2⋅105,1≤c≤1000) — the number of floors in the building and the time overhead for the elevator rides. The second line of the input contains n−1n−1 integers a1,a2,…
[题目] A. Elevator or Stairs? [描述] Masha要从第x层楼去第y层楼找Egor,可以选择爬楼梯或者坐直升电梯.已知爬楼梯每层需要时间t1:坐直升电梯每层需要时间t2,直升电梯开门或者关门一次需要时间t3,当前直升电梯在第z层楼,直升电梯门是在关闭状态的.如果爬楼梯总时间严格小于坐直升电梯,则选择爬楼梯并输出YES,否则选择坐直升电梯并输出NO. 数据范围:1<=x,y,z,t1,t2,t3<=1000 [思路] 爬楼梯总时长:t1*abs(x-y) 坐直升电梯总时…
A. Elevator or Stairs? 签. #include <bits/stdc++.h> using namespace std; ]; int main() { while (scanf("%d%d%d", &x, &y, &z) != EOF) { ; i < ; ++i) scanf("%d", t + i); ] + * t[]; ]; puts(a <= b ? "YES" :…
A - Yet Another Dividing into Teams 题意:n个不同数,分尽可能少的组,要求组内没有两个人的差恰为1. 题解:奇偶分组. int a[200005]; void test_case() { int n; scanf("%d", &n); for(int i = 1; i <= n; ++i) scanf("%d", &a[i]); sort(a + 1, a + 1 + n); int ans = 1; for…
http://codeforces.com/problemset/problem/1249/E E. By Elevator or Stairs? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are planning to buy an apartment in a n -floor building. The f…
题目传送门 A .Yet Another Dividing into Teams sol:原先是用比较复杂的方法来解的,后来学弟看了一眼,发现不是1就是2,当出现两个人水平相差为1就分成两组,1组全是奇数,1组全是偶数,必然符合题意. 思维 #include "bits/stdc++.h" using namespace std; #define debug puts("what the fuck"); typedef long long LL; typedef p…