随笔分类 -  codeforces

上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要:题目链接:https://codeforces.com/contest/1315/problem/D #include <bits/stdc++.h> using ll = long long; using namespace std; priority_queue<int> q; //默认是大顶堆 阅读全文
posted @ 2020-04-12 12:51 Kanoon 阅读(161) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1334 A. Level Statistics 题意 一个关卡有玩家的尝试次数和通关次数,按时间顺序给出一个玩家 $n$ 个时刻的数据,判断这些数据是否合理。 思路 通关次数不会多于尝试次数:$c_i≤p_i$ 后一时刻的尝试 阅读全文
posted @ 2020-04-11 02:00 Kanoon 阅读(291) 评论(2) 推荐(0)
摘要:A. Little Artem 题意 有一 $n{\times}m$ 网格,输出一种使得 与白色相邻的黑色格数 = 与黑色相邻的白色格数 $+ 1$ 的染色方案。 思路 一角染白。 代码 #include <bits/stdc++.h> using namespace std; void solve 阅读全文
posted @ 2020-04-09 16:22 Kanoon 阅读(154) 评论(0) 推荐(0)
摘要:Codeforces Round #631 (Div. 2) A. Dreamoon and Ranking Collection 题意: 已知过去 $n$ 场比赛的排名,还可以再参加 $x$ 场,问从 $1$ 起可能获得的最长连续名次序列。 思路: 记录已经获得的名次,从 $1$ 开始没有获得的名 阅读全文
posted @ 2020-04-04 15:00 Kanoon 阅读(525) 评论(5) 推荐(1)
摘要:题目链接:https://codeforces.com/contest/510/problem/D 题意: 给你一些数,问能否用它们组成所有自然数,如果可以输出最小代价(一个数的代价只需计入一次)。 思路: 裴蜀定理(又名贝祖定理):存在$x$,$y$,使得$ax+by=gcd(a,b)$。 所以只 阅读全文
posted @ 2020-04-02 23:45 Kanoon 阅读(315) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/510/problem/C 题意: 寻找一种字典序使一些字符串从小到大满足该字典序。 思路: 数据范围比较小,模拟一下拓扑排序即可。 #include <bits/stdc++.h> using namespace std; i 阅读全文
posted @ 2020-04-02 23:39 Kanoon 阅读(161) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/510/problem/B 题意: 找出矩阵中由一种字母组成的环(至少由四个点组成)。 思路: 给每个点设置一个搜索深度,如果同种字母的两个相邻点深度相差大于等于3,那么它们就可以组成一个环。 #include <bits/st 阅读全文
posted @ 2020-04-02 23:35 Kanoon 阅读(123) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/510/problem/A 题意: 用'.'和'#'输出蛇状图形。 思路: 需要找下规律的模拟题。 #include <bits/stdc++.h> using namespace std; const int M=60; in 阅读全文
posted @ 2020-04-02 23:31 Kanoon 阅读(127) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1332 A. Exercising Walk 可走的最远距离:左:x-x1,右:x2-x,下:y-y1,上:y2-y 如果可以移动,通过折返行走,两个相对方向至少有一个可以消为0,然后看余下步数是否小于等于该方向可走的最远距离 阅读全文
posted @ 2020-04-01 00:40 Kanoon 阅读(473) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1311 A. Add Odd or Subtract Even 小于差奇和大于差偶一次操作即可,其余两次,复杂度为$O_{(1)}$。 #include <bits/stdc++.h> using namespace std; 阅读全文
posted @ 2020-03-28 23:59 Kanoon 阅读(132) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1328 A. Divisibility Problem 签到题。 #include <bits/stdc++.h> using namespace std; typedef long long ll; void solve() 阅读全文
posted @ 2020-03-27 00:48 Kanoon 阅读(493) 评论(1) 推荐(1)
摘要:Codeforces Round #595 (Div. 3) A. Yet Another Dividing into Teams 相邻两个值个数和的最大值即为最少组数。 #include <bits/stdc++.h> using namespace std; void solve(){ int 阅读全文
posted @ 2020-03-26 18:54 Kanoon 阅读(133) 评论(0) 推荐(0)
摘要:Codeforces Round #621 (Div. 1 + Div. 2) A. Cow and Haybales 贪心,移到第一堆的代价即为与第一堆的距离。 #include <bits/stdc++.h> using namespace std; void solve(){ int n,d; 阅读全文
posted @ 2020-03-25 22:44 Kanoon 阅读(152) 评论(0) 推荐(0)
摘要:Codeforces Round #536 (Div. 2) A. Lunar New Year and Cross Counting 模拟,可以外加两行两列防止越界。 #include <bits/stdc++.h> using namespace std; int dir[4][2]={{-1, 阅读全文
posted @ 2020-03-25 22:28 Kanoon 阅读(147) 评论(0) 推荐(0)
摘要:Educational Codeforces Round 84 (Div. 2) 读题读题读题+脑筋急转弯 = =。 A. Sum of Odd Integers 奇奇为奇,奇偶为偶,所以n,k奇偶性要相同。 由求和公式得k个不同奇数组成的最小数为k2,所以n≥k2。 #include <bits/ 阅读全文
posted @ 2020-03-24 13:06 Kanoon 阅读(369) 评论(4) 推荐(0)
摘要:Educational Codeforces Round 59 (Div. 2) A. Digits Sequence Dividing 题意:给一个整数串s,分成至少两份,大小依次严格递增。(1≤q≤300,2≤|s|≤300) 思路:分成两份,第一位分给第一份,余下分给第二份。 #include 阅读全文
posted @ 2020-03-23 18:38 Kanoon 阅读(139) 评论(0) 推荐(0)
摘要:Codeforces Round #535 (Div. 3) A. Two distinct points 题意:从两个关系任意的区间取两个不同的数。(q≤500,1≤l,r≤109) 思路:取两个不同的端点即可。 #include <bits/stdc++.h> using namespace s 阅读全文
posted @ 2020-03-22 21:31 Kanoon 阅读(169) 评论(0) 推荐(0)
摘要:Codeforces Round #534 (Div. 2) A. Splitting into digits 题意:用1~9种类尽量少的数字拆分给定正整数n(1≤n≤1000)。 思路:签到题。 #include <bits/stdc++.h> using namespace std; int m 阅读全文
posted @ 2020-03-21 15:12 Kanoon 阅读(180) 评论(0) 推荐(0)
摘要:题意: 取一字符串不相交的前缀和后缀(可为空)构成最长回文串。 思路: 先从两边取对称的前后缀,之后再取余下字符串较长的回文前缀或后缀。 #include <bits/stdc++.h> using namespace std; string Manacher(const string &s){ s 阅读全文
posted @ 2020-03-20 10:59 Kanoon 阅读(382) 评论(0) 推荐(0)
摘要:题意: 取一字符串不相交的前缀和后缀(可为空)构成最长回文串。 思路: 先从两边取对称的前后缀,之后再取余下字符串较长的回文前缀或后缀。 #include <bits/stdc++.h> using namespace std; bool ok(const string &s,int l,int r 阅读全文
posted @ 2020-03-20 01:30 Kanoon 阅读(536) 评论(3) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 下一页