D. Diverse Garland】的更多相关文章

D. Diverse Garland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('…
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of lamps in the garland). You have to recolor some lamps in this garland (recoloring a lamp means chang…
题目链接:http://codeforces.com/problemset/problem/1108/D time limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard output You have a garland consisting of n lamps. Each lamp is colored red, green or blue. The colo…
题意:灯有三种颜色R,G,B.只要同一种颜色相邻就不可以.问最少需要换几次,可以使在一串灯中没有相邻灯的颜色相同. 思路:贪心思路:我们知道一个程序都是要子阶段,然后子阶段各个组合起来形成这个程序.那么对于每一个子阶段的贪心,就能形成整个程序的贪心. 贪心思路就是:只要出现相邻的相同a[i]==a[i+1], 然后,就选择一个a[i+1]!=a[i]&&a[i+1]!=a[i+2]的情况.注意:最后2个字母相同时,需要自己处理一下. #include<iostream> usi…
D. Diverse Garland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('…
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' - colors of lamps in the garland). You have to recolor some lamps in this garland (recoloring a lamp means chang…
CF1108A. Two distinct points 做法:模拟 如果两者左端点重合就第二条的左端点++就好,然后输出左端点 #include <bits/stdc++.h> using namespace std; int T; int l1, r1, l2, r2; int main() { scanf("%d", &T); while(T--) { scanf("%d%d%d%d", &l1, &r1, &l2,…
CF 1108A Two distinct points 题目意思:给你两个线段的起点和终点,让你给出两个不同的点,这两点分别处于两个不同的线段之中.解题思路:题目说如果存在多种可能的点,随意一组答案即可,这样其实我们只需要取最特殊的起点即可.但要注意如果起点相同,那我们需要找一个起点一个终点. #include<cstdio> #include<cmath> #include<cstring> #define ll long long int using namesp…
Codeforces Round #535 (Div. 3) 题目总链接:https://codeforces.com/contest/1108 太懒了啊~好久之前的我现在才更新,赶紧补上吧,不能漏掉了. A. Two distinct points 题意: 给出两个区间的左右边界,输出两个数,满足两个数分别在两个区间内且这两个数不相等. 题解: 直接输出左端点然后判断一下就行了. 代码如下: #include <bits/stdc++.h> using namespace std; type…
hhhh感觉我真的太久没有接触过OI了 大约是前天听到JK他们约着一起刷codeforces,假期里觉得有些颓废的我忽然也心血来潮来看看题目 今天看codeforces才知道居然有div3了,感觉应该看名字比div2还要简单吧,于是我就做了做....发现确实还蛮简单的hhhh 但是我又突发奇想,干脆更新一篇博客吧,毕竟这也是我少有的能刷完一整套CF的题,那也可以记录一下啦...(虽然div3的题解似乎拿来充当一个题解还是有点水的hhhh) A - Two distinct points 题目大意…