1499A. Domino on Windowsill

题意:给定一个 \(2 \times n\) 的空间,\(k1、k2 行要设置为白色(2 \times 1)\) 然后其他的设置为黑色

思路:为了满足条件需要判断一下白色和黑色的方块是否足够。

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _ = 1;
for (cin >> _; _--;) {
int n, k1, k2, w, b;
cin >> n >> k1 >> k2 >> w >> b;
if (2 * w <= k1 + k2 and 2 * b <= 2 * n - k1 - k2) cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}

1499B. Binary Removals

找下前缀的 0和后缀的 1的个数进行比较

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _ = 1;
for (cin >> _; _--;) {
string s;
cin >> s;
int L = 0, R = s.size() - 1;
while (L < s.size() and (s[L] == '0' or (L == 0 or s[L - 1] == '0')))
L++;
while (R >= 0 and
(s[R] == '1' or (R == (int)s.size() - 1 or s[R + 1] == '1')))
R--;
if (L >= R) cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}

学习高 Rank 的大佬写法

int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _ = 1;
for (cin >> _; _--;) {
string s;
cin >> s;
int i = s.find("11");
int j = s.rfind("00");
cout << (i != -1 && j != -1 && i < j ? "NO" : "YES") << endl;
}
return 0;
}

1499C. Minimum Grid Path

using ll = long long;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int _ = 1;
for (cin >> _; _--;) {
int n;
cin >> n;
vector<int> c(n);
ll ans = LLONG_MAX;
ll mi[2] = {(ll)1E13, (ll)1E13}, sm[2] = {0, 0}, cnt[2] = {0, 0};
for (int i = 0; i < n; ++i) {
ll c;
cin >> c;
mi[i & 1] = min(mi[i & 1], c);
cnt[i & 1] += 1;
sm[i & 1] += c;
ans = min(ans, mi[0] * (n - cnt[0]) + sm[0] + mi[1] * (n - cnt[1]) +
sm[1]);
}
cout << ans << "\n";
}
return 0;
}

Educational Codeforces Round 106 (Rated for Div. 2) 简单题解(A~C)的更多相关文章

  1. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  2. Educational Codeforces Round 59 (Rated for Div. 2) DE题解

    Educational Codeforces Round 59 (Rated for Div. 2) D. Compression 题目链接:https://codeforces.com/contes ...

  3. Educational Codeforces Round 106 (Rated for Div. 2)

    就ac了2题... A题一开始题意模模糊糊的似懂非懂,然后自己按样例推出了题意,简单题很容易ac了.还是自己的英语水平太菜了.... B题根据0和1的位置关系能看出来,因为0不能在1后面, 所以有00 ...

  4. Educational Codeforces Round 57 (Rated for Div. 2) ABCDEF题解

    题目总链接:https://codeforces.com/contest/1096 A. Find Divisible 题意: 给出l,r,在[l,r]里面找两个数x,y,使得y%x==0,保证有解. ...

  5. Educational Codeforces Round 80 (Rated for Div. 2)部分题解

    A. Deadline 题目链接 题目大意 给你\(n,d\)两个数,问是否存在\(x\)使得\(x+\frac{d}{x+1}\leq n\),其中\(\frac{d}{x+1}\)向上取整. 解题 ...

  6. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  7. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  8. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  9. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  10. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

随机推荐

  1. 两道题浅析PHP反序列化逃逸

    两道题浅析PHP反序列化逃逸 一.介绍 反序列化逃逸的出现是因为php反序列化函数在进行反序列化操作时,并不会审核字符串中的内容,所以我们可以操纵属性值,使得反序列化提前结束. 反序列化逃逸题一般都是 ...

  2. .net下优秀的日志框架Serilog,你用上了吗?强烈推荐

    在 .NET 开发中,Serilog 是一款广受欢迎的日志库,它提供了强大的日志记录功能,具有丰富的特性和高度的可扩展性.Serilog 的优秀之处包括: 可扩展性: Serilog 可以轻松扩展以满 ...

  3. 开发工具使用:CubeMX、KEIL MDK-ARM

    来源:成电<微机原理与嵌入式系统>漆强 第四章 STM32CubeMX软件的使用 来源:成电<微机原理与嵌入式系统>漆强 第五章 MDK-ARM软件的使用 一.STM32的Cu ...

  4. 使用汇编和反汇编引擎写一个x86任意地址hook

    最简单的Hook 刚开始学的时候,用的hook都是最基础的5字节hook,也不会使用hook框架,hook流程如下: 构建一个jmp指令跳转到你的函数(函数需定义为裸函数) 保存被hook地址的至少5 ...

  5. 【笔记整理】request模块基本使用

    基本使用 发送get请求.获取响应各种请求.响应信息 def fun1(): url = "http://www.baidu.com" resp = requests.get(ur ...

  6. python tkinter 使用(六)

    python tkinter 使用(六) 本文主要讲述tkinter中进度条的使用. 1:确定的进度条 progressbar = tkinter.ttk.Progressbar(root, mode ...

  7. 学习JVM---入门

    1.JVM体系结构 JVM的位置 JVM体系结构 2.类加载器 双亲委派机制 package java.lang; /** * 测试自定义java.lang.String类能否运行成功 * 体会双亲委 ...

  8. Python——第二章:字符串操作——总结

    总结: f"{变量}"  格式化字符串最优方法 索引.切片.步长: 索引:从0开始计算的.[5] 切片:s[start: end: step],end位置的数据永远拿不到,左闭又开 ...

  9. linux安装redis、ununtu和centos等类似的发行版安装redis,完全离线安装reids,自定义版本redis

    redis各个版本源码包下载:Index of /releases/ (redis.io) 下载与解压 从Index of /releases/ (redis.io)选择自己需要的版本并下载(此处以r ...

  10. 使用WPF开发自定义用户控件,以及实现相关自定义事件的处理

    在前面随笔<使用Winform开发自定义用户控件,以及实现相关自定义事件的处理>中介绍了Winform用户自定义控件的处理,对于Winform自定义的用户控件来说,它的呈现方式主要就是基于 ...