首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
dreamoon专题
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
阅读更多...
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
阅读更多...