likes专题

【图解版】Likes Vs Dislikes——C语言提高题【7 kyu】

一、原题 链接:Training on Likes Vs Dislikes | Codewars YouTube had a like and a dislike button, which allowed users to express their opinions about particular content. It was set up in such a way that you

Dreamoon Likes Coloring CodeForces - 1330C(贪心+思维)

Dreamoon likes coloring cells very much. There is a row of n cells. Initially, all cells are empty (don’t contain any color). Cells are numbered from 1 to n. You are given an integer m and m integer

Talking about likes

Tutorial Hi! Tim here with another 925English lesson! In today’s lesson, we’re learning how to talk about likes and preferences. Why It’s Important: Talking about things we like is common in various

Codeforces Round #631 (Div. 1)C. Drazil Likes Heap

题意:将大顶堆从高度h降低到g,必须应用题中的算法保证它们的和最小,输出和,并且输出被删除操作的序号,答案不唯一。 思想: 1.贪心算法:考虑到最小和,又没有有效的办法去维护,所以考虑到贪心,因为是大顶堆,所以根节点一定是最大的,所以如果他的两个子树的深度有一个大于g-1时,就要对根节点执行算法删除操作,因为算法挑大的儿子结点删,所以每次走存储数值大的结点,然后递归上调结点链,判断子树深度,重

Codeforces Round #631 (Div. 2) - Thanks, Denis aramis Shitov! C. Dreamoon Likes Coloring(贪心+思维)

题目链接 #include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+5;int p[maxn];int ans[maxn];int main(){int n,m;ll sum=0;scanf("%d %d",&n,&m);int cnt=n;for(int i=1;i<=

Codeforces Round #631 (Div. 2) - Thanks, Denis aramis Shitov! D. Dreamoon Likes Sequences(位运算+数学)

题目链接 思路:能满足条件的a数组一定满足a【i-1】<a【i】并且a【i-1】的最高位要小于a【i】的最高位,例如a【i-1】为10的话,a【i】可以为100、1000、10000.。。。(以上以下都用二进制表示),由于n的长度不限定,我们就先找到2的幂次方中与d靠最近的(也就是代码里的pos),我们就可以考虑以下每一位的贡献,对于第i位a【i】有几种选择,假设a【i】是要从100和1000

题解 CF1395A 【Boboniu Likes to Color Balls】

正文 具体思路 形成回文串条件: 1奇3偶 或 3奇1偶 或 全部为奇数或偶数 无法形成条件: 2奇2偶 r , g , b r,g,b r,g,b 中任意一个为 0 代码如下 #include <cstdio>using namespace std;int main() {long long n,r,g,b,w,cnt;scanf("%lld",&n);for(int i