
codeforces刷题日记
文章平均质量分 78
QuteMelon
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
图(刷题记录)自用
文章目录HDU 55211408E - Avoid Rainbow CyclesHDU 5521难点: 集合内的点1408E - Avoid Rainbow Cycles原创 2020-11-06 10:04:39 · 177 阅读 · 0 评论 -
Codeforces Round #680 (Div. 2, based on Moscow Team Olympiad)解题报告
文章目录A.Array RearrangmentB . EliminationE - Team-Building带权并查集维护二分图:可撤销并查集:A.Array Rearrangment思路: 将数组A和数组B排序一下,遍历整个数组,check头尾相加是否大于x(是则No)B . Elimination思路: 比较a+b,c+d,取最值E - Team-Building思路: 如果不考虑矛盾的情况,则一共有Ck2/2C_k^2/2Ck2/2种可能性:现在考虑矛盾的情况,显然如果能够分成两个原创 2020-11-02 21:07:48 · 257 阅读 · 0 评论 -
Codeforces Round #672 (Div.2) 解题报告
Codeforces Round #672 (Div.2)A. 冒泡排序最差情况是逆序,交换操作为n(n−1)/2n(n-1)/2n(n−1)/2 次,因此该题判断一下是否完全逆序即可。#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e5+5;int arr[maxn];int main(){ ios::sync_with_stdio(false);原创 2020-09-25 11:50:51 · 499 阅读 · 0 评论 -
Codeforces Educational Round 95 解题报告
Codeforces Educational Round 95 解题报告A. 题解: 计算出所需要的棍子数量 sticks = k * ( y + 1),然后答案是(stick−1)/(x−1)+((stick−1)mod (x−1)==0?1:0)+k(stick - 1)/(x - 1) + ((stick-1)\mod (x-1) == 0 ? 1 : 0) + k(stick−1)/(x−1)+((stick−1)mod(x−1)==0?1:0)+kB. 题解: 将unlocke原创 2020-09-15 09:47:06 · 316 阅读 · 0 评论 -
Codeforces Educational#29 A-E题解
A. 题解: 把后缀0去掉后判断是否为回文串即可#include <bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int x; cin >> x; string str; bool isok = false; while(x){ if(isok || x%10原创 2020-09-04 14:20:58 · 198 阅读 · 0 评论 -
Codeforces #430 A-E 题解
A.题意很简单,给出两个区间[l,r][l,r][l,r],[x,y][x,y][x,y],问是否存在两个数aaa,bbb,满足aaa在第一个区间,而bbb在第二个区间,且a/b=ka/b = ka/b=k。数据范围1e7,暴力遍历区间[x,y][x,y][x,y],计算b∗kb*kb∗k能否落在区间一即可。#include <bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(false);原创 2020-08-30 11:49:02 · 240 阅读 · 1 评论 -
杂题
1285B Just Eat It!最大子段和(dp O(n))#include <bits/stdc++.h>using namespace std;const int maxn = 2e5 + 5;long long dp[maxn];int arr[maxn];int main(){ ios::sync_with_stdio(false); cin....原创 2020-01-14 22:40:53 · 148 阅读 · 0 评论 -
CodeForces——Tetris 961A
A. Tetristime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a following process.There is a platform with n columns. 1×1 squares ar...原创 2018-12-09 16:14:35 · 299 阅读 · 0 评论 -
Bets CodeForces - 69B 贪心 Elevator CodeForces - 117A 模拟
一道挺水的题,好好读题理解题意就可以做了题目链接代码如下:#include &lt;iostream&gt;using namespace std;const int MAX =1e3+5;struct Node{ int t; int c;}node[MAX];int main(){ int n,m; cin&gt;&gt;n&gt;&gt;m...原创 2019-03-04 15:45:45 · 597 阅读 · 0 评论 -
Gym 101502 个人题解
这次集训对c++的cin,cout极不友好,因此推荐都是 scanf 和 printf 进行IO处理,或者就是加快cin,coutA题——水题A题目链接题意: 你原来可以买 x 个物品, 现在物品涨价 y% 问你涨价后还能买多少物品。公式x /(1+y%)但是这题要注意一下精度问题不然会被卡…#include <iostream>using namespace std;...原创 2019-04-05 15:37:22 · 300 阅读 · 0 评论 -
一些思维题记(长期更新)
A. Prime Subtraction Codeforces 1238A题意: 给出两个数A,BA,BA,B,询问 ∣A−B∣|A-B|∣A−B∣是否是素数的倍数。思路:这题涉及一点小数论,每个数都能进行质因数分解(除了1),所以只要A-B不为1就输出YES,否则输出NOB. Kill 'Em All 1238B题意:在坐标xxx的地方扔炸弹,位于xxx的地方的怪会直接去世,若不位于...原创 2019-10-10 10:44:58 · 256 阅读 · 0 评论 -
codeforces #561补题
A.题意:第一个字母相同的的人放在一个教室会聊天,给出一些人的名字,问如何将他们分配到两个教室,使得聊天的pair对最少…挺水的一个题,只要将同名的人平均分到两个教室就可以了。#include <iostream>#include <cmath>using namespace std;int arr[30];int Cal(int n){ if(!n) ...原创 2019-05-28 15:18:00 · 257 阅读 · 0 评论 -
Codeforces Round #563 (Div. 2)
A. Ehab Fails to Be Thanos题意:给一个长度为2n2n2n的数组,问是不是能否重排数组,使得数组前nnn个数之和和后nnn个数之和不同解:如果数组每个元素都相同,那么就肯定不能了,反之就直接一个sort即可#include <iostream>#include <algorithm>using namespace std;typedef ...原创 2019-06-10 22:29:24 · 135 阅读 · 0 评论 -
Codeforces Round #560 (Div. 3)D题Almost All Divisors
这题觉得挺有意思的,就写篇博客记录一下,主要还是学到了一些东西吧结论:1. 如果一个序列aaa中的数是 一个数xix_ixi的除1和本身的所有因子,那么这个xix_ixi的值将为 min(a)∗min(b)min(a)*min(b)min(a)∗min(b)2. 如何得到一个数的所有因子(2 <= i < x) for(int i = 2; i < x; ++i){...原创 2019-06-01 14:48:55 · 184 阅读 · 0 评论 -
Codeforces Round #569 (Div. 2)
A. Alex and a Rhombus(找规律水题)这题…找一下规律就很容易得到 f(1) = 1,f(n) = f(n-1) + 4*(n-1),先打表,然后直接输出即可#include <iostream>using namespace std;typedef long long ll;int f[105];int main(){ f[1] = 1; for...原创 2019-09-05 13:18:03 · 175 阅读 · 0 评论 -
Codeforces Round #583 (Div. 1 + Div. 2, based on Olympiad of Metropolises)
A. Optimal Currency Exchange就是汇率问题,不难发现,我们其实只要换dollardollardollar或euroeuroeuro的最小面值即可,也就是1,和5,其他面值可以通过这两个比例得到,所以问题就简化了。于是暴力即可#include <iostream>using namespace std;int main(){ int n; ...原创 2019-09-05 13:11:29 · 282 阅读 · 0 评论