Codeforces Round #601 (Div. 2) A Changing Volume
好吧,其实我拿到这个题的时候,首先想到了bfs,写完之后,开开森森的去交代码,却在第二个数据就TEL,然后优化半天,还是不行。
最终,我盯着1,2,5发呆半天,wc,然后直接贪心
#include<iostream>
using namespace std;
int main() {
int T;
cin>>T;
while(T--) {
int a,b;
cin>>a>>b;
int x = abs(a - b);
int ans = x / ;
x %= ;
ans += x / ;
x %= ;
ans += x;
cout<<ans<<endl;
}
return ;
}
Codeforces Round #601 (Div. 2) A Changing Volume的更多相关文章
- Codeforce 1255 Round #601 (Div. 2) A. Changing Volume (贪心)
Bob watches TV every day. He always sets the volume of his TV to bb. However, today he is angry to f ...
- 【cf比赛记录】Codeforces Round #601 (Div. 2)
Codeforces Round #601 (Div. 2) ---- 比赛传送门 周二晚因为身体不适鸽了,补题补题 A // http://codeforces.com/contest/1255/p ...
- Codeforces Round #601 (Div. 2)
传送门 A. Changing Volume 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/19 22:37:33 */ #include ...
- Codeforces Round #601 (Div. 2) E2. Send Boxes to Alice (Hard Version)
Codeforces Round #601 (Div. 2) E2. Send Boxes to Alice (Hard Version) N个盒子,每个盒子有a[i]块巧克力,每次操作可以将盒子中的 ...
- Codeforces Round #601 (Div. 2) E1 Send Boxes to Alice (Easy Version)
#include <bits/stdc++.h> using namespace std; typedef long long ll; ; int a[N]; int n; bool pr ...
- Codeforces Round #601 (Div. 2) D Feeding Chicken
//为了连贯,采取一条路形式,从第一行开始 也就是s型 #include <bits/stdc++.h> using namespace std; ; char str[MAXN][MAX ...
- Codeforces Round #601 (Div. 2) C League of Leesins
把每一次输入的一组数字存下来,然后把每个数字出现的组数存下来 然后找只出现过一次的数字a,那么这个数字a不是开头就是结尾,默认为开头(是哪个都无所谓),然后去找和它出现在同一组的两个数字b和c,而b和 ...
- Codeforces Round #601 (Div. 2) B Fridge Lockers
//题目要求的是每一个点最少要有两条边连接,所以可以先构成一个环.然后再把剩余的最短的边连接起来 #include<iostream> #include<algorithm> ...
- Codeforces Round #601 (Div. 2)E(寻找质因子,DP)
先分解质因数,对于当前a[i],假设当前的质因数为x,这个位置要满足能被k整除,有两个可能,要么是它向后一个转移x%k个,要么是后一个向它转移k-x%k个. 对于每一个a[i]满足后,因为只会对下一个 ...
随机推荐
- opencv —— Laplacian 拉普拉斯算子、二阶导数用于边缘检测
Laplacian 算子简介 求多元函数的二阶导数的映射又称为 Laplacian 算子: 计算拉普拉斯变换:Laplacian 函数 void Laplacian(InputArray src, ...
- 全栈之路-小程序API-SpringBoot项目中参数校验机制与LomBok工具集使用
参数校验机制在web开发中是非常重要的,每当看到现在所在公司的校验代码,我都有头疼,每一个接口都是重新写参数的校验,有些复杂的接口,参数的校验甚至占了整个接口代码量的挺大一部分的,看着我都有些头疼,我 ...
- [CF1311B] WeirdSort
Solution 按照 \(p[i]\) 进行分段,如果某个 \(k\) 不存在 \(p[i]=k\),那么就把 \(i,i+1\) 分割开 处理出每一段的左端点和右端点 进而处理出每段的最小值和最大 ...
- Python3 协程相关 - 学习笔记
什么是协程 协程的优势 Python3中的协程 生成器 yield/send yield + send(利用生成器实现协程) 协程的四个状态 协程终止 @asyncio.coroutine和yield ...
- day 9 深浅拷贝
浅copy 现有数据 data = { "name":"alex", "age":18, "scores":{ &quo ...
- jquery ajax简单书写
占时无法显示该内容,请稍后再试 $.ajax({ url:"http://v.juhe.cn/weather/index", data:{cityname:"苏州&quo ...
- springboot打成war包并携带第三方jar包
1.修改打包方式为war <packaging>war</packaging> 2.添加第三方依赖的jar到pom 我的第三方jar包在resoueces目录下 ...
- CF round 623 Div.1D Tourism 题解
题目链接:https://codeforces.com/contest/1314/problem/D 大意: \(n\) 个顶点的有向图,顶点编号为 \(1\) 到 \(n\),任意两个不同的顶点 \ ...
- 第6章.BitArray类
参考链接: https://www.cnblogs.com/wang7/archive/2012/04/13/2446353.html https://www.runoob.com/csharp/cs ...
- sum用法
自带的sum 用法: 但是2个列表或者2个元组放在里面就报错了.这时候就要用到 numpy 里面的sum 用法了 import numpy as np list1 = [1,2,3,4,5] list ...