[题目] 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. Distance and Axis 题目:http://codeforces.com/contest/1401/problem/A 题解:对于n来说分两种情况,一是奇数,二则是偶数 ①奇数:对于k来说如果是奇数且小于等于他,ans=0:若k是奇数并且大于n,则ans=k-n:若k是偶数并且k<n,那么ans=1:若k为偶数并且k>n,则ans=k-n ②偶数:若k为偶数并且k<=n,则ans=0:若k为偶数并且k>n,则ans=k-n:若k为奇数并且k<n,则ans=1…
A. Ahahahahahahahaha 题目:http://codeforces.com/contest/1407/problem/A 题解:最多进行n/2的操作次数,我们统计这n个数中1的个数,是否过半,如果没有代表0过半,因此输出剩余的0的个数即可 如果1的个数过半,则考虑1的个数是奇数还是偶数,若为奇数,则再减去一个输出:若为偶数个,则直接输出. 代码: #include<bits/stdc++.h> using namespace std; typedef long long ll;…
Elevator 怎么今天写啥题都不会写啊, 我是傻了吗.. 把电梯里面四个人的目标点当作状态, 然后暴力转移. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int…
Codeforces Round #431 (Div. 2) A. Odds and Ends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Where do odds begin, and where do they end? Where does hope emerge, and will they ever break…
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,…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output On her way to programming school tiger Dasha faced her first test - a huge staircase! The steps were numbered from one to infinity. As we know,…
Problems # Name A Infinite Sequence standard input/output 1 s, 256 MB x3509 B Restoring Painting standard input/output 1 s, 256 MB x2519 C Money Transfers standard input/output 1 s, 256 MB x724 D Tree Construction standard input/outp…
Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arpa is researching the Mexican…
这题一看就筛质数就好啦, 可是这怎么筛啊, 一看题解, 怎么会有这么骚的操作. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #define SZ(x…
这里没有翻译 Codeforces Round #545 (Div. 1) T1 对于每行每列分别离散化,求出大于这个位置的数字的个数即可. # include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn(1005); int n, m, a[maxn][maxn], mx1[maxn][maxn], mx2[maxn][maxn], q[maxn], len; int main() { i…
一.题目链接:http://codeforces.com/contest/988/problem/F 二.题面 三.思路 很明显而且比较能想到的$dp$. 四.代码实现 #include<bits/stdc++.h> using namespace std; #define fst first #define snd second #define MAXN 2018 typedef pair<int, int> PII; typedef long long LL; int dest…