Educational Codeforces Round 100 (Rated for Div. 2)补题记录
总结:感觉这个educational场好难啊(蒟蒻视角),又被虐了,唉
A. Dungeon
- 每一枪会造成1点伤害对一个单位,但是当开7的倍数枪时会造成3点伤害
- 每7次一个轮回,一个完整的轮回共造成9点伤害,如果最后一起死,那个最小值至少需要承受每个轮回的1点伤害
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (-x))
using namespace std;typedef long long ll;int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endifint t;cin >> t;while (t--) {int a, b, c;cin >> a >> b >> c;int min1 = min(a, min(b, c));ll sum = a + b + c;if (sum % 9 == 0 && min1 >= sum / 9) cout << "YES" << endl;else cout << "NO" << endl;}return 0;
}
B - Find The Array
- 哇,这个题可真是够难,想不出来
- 最后经大神提醒,每个数直接取他的二进制最高位就可以,既保证了倍数,又保证了总和不会超过原来的一半
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (-x))
using namespace std;typedef long long ll;
const int N = 100;int a[N], b[N];int solve(int x) {int cnt = 0;while (x) {cnt++;x >>= 1;} return 1 << (cnt - 1);
}int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endifint t;cin >> t;while (t--) {int n;cin >> n;for (int i = 1; i <= n; i++) {cin >> a[i];b[i] = solve(a[i]);}for (int i = 1; i <= n; i++) {if (i != 1) cout << " ";cout << b[i];}cout << endl;}return 0;
}
C - Busy Robot
模拟题
- 最后的时间时是正无穷
- 一个命令若是要执行成功,那么必须在下一个命令要求的时间之前(包括端点)到达这个命令的终点
- 一个命令执行时,会忽略在此期间发过来的命令(虽然被忽略,但是也可能成功执行,符合上一个条件即可)
- 一个被忽略的命令若想成功执行,则至少需要包含在正在行进的路径中
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (-x))
using namespace std;typedef long long ll;
const int N = 1e5 + 10;
const int inf = 0x3f3f3f3f;
#define int long long
struct node {ll t, pos;
}e[N];
int book[N];signed main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endifint t;scanf("%lld", &t);while (t--) {int n;scanf("%lld", &n);memset(book, 0, sizeof book);for (int i = 1; i <= n; i++) scanf("%lld%lld", &e[i].t, &e[i].pos);e[n + 1].t = 1e18; int cnt = 0, st = 0;for (int i = 1; i <= n; i++) {if (!book[i]) {book[i] = 1;if ((e[i + 1].t - e[i].t >= abs(e[i].pos - st))) cnt++; int ed = e[i].t + abs(e[i].pos - st);int j = i + 1;while (j <= n && e[j].t < ed) {book[j] = 1;int flag = 0;if (e[j].pos >= st && e[j].pos <= e[i].pos) flag = 1;if (e[j].pos >= e[i].pos && e[j].pos <= st) flag = 1;if (flag && (e[j].t - e[i].t) <= abs(e[j].pos - st) && (e[i].t + abs(e[j].pos - st) <= e[j + 1].t)) cnt++;j++;}st = e[i].pos;}}printf("%lld\n", cnt);} // return 0;
}
D - Pairs
这位大佬的思路 https://blog.csdn.net/ANTFANAAA/article/details/111351485
也是模拟题
- 有些点只能作为最小值出现
- 有些点只能作为最大值出现
- 有些点既能作为最小值,也能作为最大值
- 那么怎么求重合的这部分呢?那就是ans1 + ans2 - n
- 最终是求最小值包含的数的所有情况,那就是 重合部分 + 初始值(也就是1)
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (-x))
using namespace std;typedef long long ll;
const int inf = 0x3f3f3f3f;
// #define int long long
const int N = 1e6 + 10;
int book[N], a[N];int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endifint t;scanf("%d", &t);while (t--) {int n;scanf("%d", &n);set<int> v1, v2;for (int i = 1; i <= 2 * n; i++) book[i] = 0;for (int i = 1; i <= n; i++) {scanf("%d", &a[i]);book[a[i]] = 1;}for (int i = 1; i <= 2 * n; i++) {if (!book[i]) {v1.insert(i);v2.insert(i);}}int ans1 = 0, ans2 = 0;for (int i = 1; i <= n; i++) {auto t1 = v1.lower_bound(a[i]);auto t2 = v2.lower_bound(a[i]);if (t1 != v1.end()) {ans1++;v1.erase(t1);}if (t2 != v2.begin()) {ans2++;t2--;v2.erase(t2);}}printf("%d\n", (ans1 + ans2 - n) + 1);}return 0;
}
Educational Codeforces Round 100 (Rated for Div. 2)补题记录相关推荐
- Educational Codeforces Round 131 (Rated for Div. 2)刷题记录OR题解
题解 A Grass Field 题面翻译 给出一个 2×22 \times 22×2 的矩阵,矩阵的值都是 000 和 111,定义一次操作:选择一个点,将其所在的行和列的点的值全部修改为 000, ...
- Educational Codeforces Round 100 (Rated for Div. 2)
文章目录 Educational Codeforces Round 100 (Rated for Div. 2) A. Dungeon B. Find The Array C. Busy Robot ...
- Educational Codeforces Round 103 (Rated for Div. 2)前四题
Educational Codeforces Round 103 (Rated for Div. 2) 第二次被别人hack,悲 A - K-divisible Sum 题意 给定两个整数 n,kn, ...
- Educational Codeforces Round 133 (Rated for Div. 2) D题
题目链接:Problem - D - Codeforces 一道非常经典的完全背包求方案数题: 首先先写好我们的状态转移方程,那什么代表体积,什么代表物品数目呢: 其实很清晰k, k + 1 ... ...
- codeforces Educational Codeforces Round 49 (Rated for Div. 2) C题
刚开始拿到这题很懵逼,知道了别人的思路之后开始写,但是还是遇到很多坑,要求求P2/S最大.p=a b.就是求(a2+ b2 +2ab)/ab最大,也就是a/b +b/a最大.那么题意就很明显了. 但是 ...
- Educational Codeforces Round 119 (Rated for Div. 2) 做题日志
A Equal or Not Equal 题意 给你一个字符串, s i = = E si == E si==E表示 a ( i ) = = a ( i + 1 ) a(i) == a(i+1) a( ...
- Educational Codeforces Round 33 (Rated for Div. 2) B题
B. Beautiful Divisors Recently Luba learned about a special kind of numbers that she calls beautiful ...
- Educational Codeforces Round 74 (Rated for Div. 2)
Educational Codeforces Round 74 (Rated for Div. 2) 原题地址 # 题目 分数 是否AC A Prime Subtraction 900 ✅ B Kil ...
- Educational Codeforces Round 89 (Rated for Div. 2)(A, B, C, D)
Educational Codeforces Round 89 (Rated for Div. 2) A. Shovels and Swords 思路 题意非常简单,就是得到最多的物品嘛,我们假定a, ...
最新文章
- 命令行中创建和打开模Android拟器
- Java 关键字和语句
- 淘宝技术沙龙「系统稳定性与性能」的笔记与思考
- 《中国人工智能学会通讯》——11.21 结束语
- [html] 对于写一个页面布局,html/css/js这三者你是先写哪个后写哪个?
- Python基础教程学习目录 - Python入门教程
- Atitit 遍历 与循环模式大总结 目录 1.1. 遍历的对象 数组 或对象 或对象数组	1 2. 遍历的概念	2 2.1. 祖先后代同胞 过滤	2 3. 常见的遍历四种方式	2 3.1.
- table函数--Matplotlib
- 安卓设计模式、安卓进阶、kotlin中文文档pdf学习资料
- arcpy判断图层是否存在的方法
- 表情识别android项目,Github项目推荐 | Emotion-recognition 实时表情识别
- 微信小程序富文本解析点击图片放大_小程序富文本提取图片可放大缩小
- 关于某normal大学数据库登录的一个尝试
- ppt 计算机图标不见了,我PPT的图标变成这样了,为什么
- Excel leftjoin
- python中的header是什么意思_python中header是什么意思啊
- 百度云怎么快速清理和谐文件啊
- Win10系统ie浏览器打不开网页的2种解决方法
- win10安装Redis windows版Redis
- CAT翻译软件真的是翻译神器吗?
热门文章
- VUE3+ElementPlus如何实现文件上传
- dc是什么游戏的简称_美国各个州的简写是什么?就是像DC这种形式的
- 免费、开源、100页开发学习手册,学习GD32不可或缺的利器
- java 实现58热敏票据打印
- 创建SQL Server 身份验证登陆账户
- iOS 5 cocos2d游戏开发实战(第2版)
- 5.(人脸签到)疫情下的在线办公签到系统-进阶篇
- linux创建进程读共享写复制,Linux进程创建之fork浅析
- 富士通DPK8400E打印机
- 安川最小巧机器人_安川电机:全球首台小巧快GP系列机器人出货