![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
qq_41854014
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #693 (Div. 3)
人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想C. Long Jumps如果直接按照题意去模拟,肯定会超时的.可以从后往前递推.#include<bits/stdc++.h>using namespace std;const int maxn = 2e5 + 5;int t, n;int a[maxn];int score[maxn];int main(){ cin >> t; while(t--)原创 2021-01-13 14:31:31 · 96 阅读 · 0 评论 -
CF1206A Choose Two Numbers
水题,不解释.数学+排序附ac代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;ll n, m; int a[205], b[205];int main(int argc, char const *argv[]){ cin >> n; for (int i = 0;...原创 2020-03-18 14:31:38 · 68 阅读 · 0 评论 -
CodeForces 1000C
差分1.把每一条线段看成两个端点,左端点为1,右端点+1为-12.把这些线段按左端点排序,用一个sum维护当前区间上有多少条线段3.然后遍历一遍即可附上ac代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;std::map<ll, ll> flag;std::map<...原创 2020-03-18 09:58:32 · 207 阅读 · 0 评论 -
CodeForces 1000B Light It Up
思维题,参考了网上的一些做法.1.首先,开两个数组a[i]和t[i]分别记录时间点和开灯时间.2.m - t[n + 1]:翻转后亮灯总时间3.a[i] - t[i]:点i前所有亮灯时间4.所以m - t[n + 1]-(a[i] - t[i])即为i点后亮灯总时间5.再加上前面的时间:t[i]-1.即为总时间m - t[n + 1]-(a[i] - t[i])+t(i)-1,然后遍历...原创 2020-03-16 17:47:06 · 122 阅读 · 0 评论 -
D. Count the Arrays
一道排列组合题.思路:1.从m个数中选出n-1个(因为有2个数相同)2.这n - 1个数中选择一个元素作为重复的数3.剩下n-3个数按照顺序可以插入左边或者右边 pow(2, n-3)种所以结果为C(m,n-1)×(n-2)×pow(2, n-3)快速幂+卢卡斯附ac代码:#include<bits/stdc++.h>using namespace std;type...原创 2020-03-16 11:28:32 · 171 阅读 · 1 评论 -
C. Adding Powers
位运算.一开始没什么思路,参考了下别人的做法.链接: https://www.cnblogs.com/LH2000/p/12455934.html.附ac代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(int argc, char const *argv[]){ l...转载 2020-03-15 15:49:23 · 113 阅读 · 0 评论 -
B. Bogosort
思维题.由j−aj≠i−ai 得j-i≠aj-ai.由j>i,使得aj-ai<=0即可.数组以非递增顺序排列即可.附ac代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;bool cmp(int a, int b){ return a > b;}int mai...原创 2020-03-15 11:14:37 · 67 阅读 · 0 评论 -
A. Two Regular Polygons
水题,判断大小正多边形的中心是否重合.思路:判断n能否整除m即可.附ac代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(int argc, char const *argv[]){ ll t; cin >> t; for (int i = 0; i ...原创 2020-03-15 10:25:35 · 92 阅读 · 0 评论