随笔分类 -  刷题补题

摘要:E ginger的染色 首先对于一个排列 ,如果看成环图的结构,那么 就向 连一条无向边。所以对于任意一个排列就会产生若干个环,连通性可以用并查集维护,现在对每个点进行黑白染色,题意转换为对于环中任意相邻两点颜色不能相同,那么只有偶数元环才能够染色成二分图,而每个偶环的方案数为 ,设当前有 个环,总 阅读全文
posted @ 2022-06-21 21:29 好腻友Π 阅读(35) 评论(0) 推荐(0)
摘要:个人赛-1 Magical Bamboos 思路:从大到小排序,然后从头到尾遍历,每相邻两个数相差为偶数,则这两个数可以都变成他俩的平均数,对后面的数包括这两个数的后一个数他们相当于都增加了一个值,但这并不改变原本两两之间的差值。因此如果两两之间差值都为偶数,则可以变成同一个值。 Make Cent 阅读全文
posted @ 2022-06-20 20:55 好腻友Π 阅读(25) 评论(0) 推荐(0)
摘要:islands dfs #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=55; char a[N][N]; int n,m,res; int dx[4]= {-1,0,1,0}; int 阅读全文
posted @ 2022-06-17 21:21 好腻友Π 阅读(25) 评论(0) 推荐(0)
摘要:bookshelf filling 二分,从右边的长度为b的书中选tt本,看上面剩下的空间能否摆下tt本。因为tt的值越小,越有可能摆下,所以满足二分的性质。 #include <bits/stdc++.h> using namespace std; typedef long long ll; co 阅读全文
posted @ 2022-06-10 20:12 好腻友Π 阅读(71) 评论(0) 推荐(0)
摘要:B #include <iostream> #include <algorithm> #include <cstring> #include <math.h> using namespace std; typedef long long ll; const int N=1e3+10; char s[ 阅读全文
posted @ 2022-06-01 08:47 好腻友Π 阅读(30) 评论(0) 推荐(0)
摘要:C题-planet communication 用坐标判断向量平行: if (x * y1 == x1 * y && x * z1 == x1 * z && y * z1 == y1 * z) 不要用对应坐标成比例,还需要特判比例为0.思路就是假设每一个星球都需要一个光线,那么每有一个星球与某个星球 阅读全文
posted @ 2022-05-27 19:12 好腻友Π 阅读(52) 评论(0) 推荐(0)
摘要:D题(一整个没想法,那就看题解吧!) #include <bits/stdc++.h> using namespace std; typedef long long ll; void test_case() { int a, b, c, d; cin >> a >> b >> c >> d; str 阅读全文
posted @ 2022-05-27 15:26 好腻友Π 阅读(37) 评论(0) 推荐(0)
摘要:C题,找规律 在最小循环节里统计不同数的个数就行 #include <iostream> #include <cstring> #include <algorithm> #include <math.h> using namespace std; typedef long long ll; cons 阅读全文
posted @ 2022-05-20 01:02 好腻友Π 阅读(27) 评论(0) 推荐(0)
摘要:G-goblin garden guards 题目里半径最大才100,所以40000比100000小得多,就还是采用了最开始的想法。 #include <iostream> #include <cstring> #include <algorithm> #include <math.h> using 阅读全文
posted @ 2022-05-16 00:52 好腻友Π 阅读(29) 评论(0) 推荐(0)
摘要:L-candy machine 用sort过不了,用手写快排过的。 #include <iostream> #include <cstring> #include <algorithm> #include <math.h> using namespace std; typedef long long 阅读全文
posted @ 2022-05-15 00:48 好腻友Π 阅读(35) 评论(0) 推荐(0)