- 博客(26)
- 收藏
- 关注
原创 关于docker安装openwrt 旁路由导致无法获取主机控制权的记录
虽然这个是在N1上操作的,但是思路基本都差不多;网上搜了半天也没搜到办法,把/etc/init.d/docker 和 /usr/bin/docker 删了docker居然还是能启动,给我惊了;后面突然想到能不能通过直接改配置文件的办法修改重启策略,还真给我找到了,万幸,不然又要重装系统;
2023-08-10 01:04:54
653
原创 CCCC L3-025 那就别担心了
L3-025 那就别担心了 (30 分)思路:dfs+剪枝,对于某一个已经跑过的点,可以记录它的答案,下一次再询问它的时候,直接取答案就行,不需要再dfs这个点了坑:如果此时是这副图,且起点和终点分别是1和3,那么也要输出yes。“从某个命题出发的所有推理路径都会将结论引导到同一个最终命题”这句话,并不是要走到底,只要走到终点就要停下来。。。,所以只要设置vis[end]=1就行了代码:int n, m;vector<int> G[502];int s, t;int p=
2022-04-21 21:30:34
410
原创 E. Are You Fired?
Codeforces Round #645 (Div. 2)题意:一个长度为n的数组,前(n+1)/2个数随机,剩下的数都为x;找一个k,满足 任意长度为 k 的 区间(连续)的和 > 0思路:k > n / 2, 若存在 k < n/2 且满足要求,那么 k * 2 一定满足,小区间都满足了,大区间显然更满足如果 x >= 0:a. 总和 > 0,直接输出n;b. 如果总和 < 0,那么一定不存在;因为 k > n / 2,加了剩下所有
2021-09-07 20:30:43
157
原创 D. Yet Another Yet Another Task
Educational Codeforces Round 88 (Rated for Div. 2)题意:定义一个区间的值 = 区间和 - 最大值(重复的只删一次),求给定数组的最大值思路:由于ai很小,可以直接枚举最大值。AC代码:int n; int a[200005];void work(){ cin>>n; for(int i=1;i<=n;++i) cin>>a[i]; int ans=0; for(int i=1;i<=30;++i)
2021-09-07 19:25:04
154
原创 Windows10 删除快捷方式的箭头
win + r 打开 运行, 输入 regedit, 打开注册表编辑器输入以下地址:计算机\HKEY_CLASSES_ROOT\lnkfile右键删除其中的 IsShortcut 后,重启电脑即可
2021-09-07 09:31:40
181
原创 Codeforces Round #377 (Div. 2)
B. Cormen — The Best Friend Of a Man题意:给出某人原计划n天内各天遛狗的次数,但是要求任意相邻两天遛狗的次数要不小于k,求需要增加的遛狗的次数思路:dp[i][j] 表示 第i天 遛狗j次。如果某天遛狗次数小于原定计划的次数,则对答案的贡献为0。Code:#define ll long long#define INF 0x3f3f3f3fll n, m, k;ll dp[502][502]; // dp[i][j] 表示 第i天 遛狗j次ll s
2021-07-29 11:38:58
137
原创 codeblocks 更改主题 windows
关闭codeblocks软件。下载文件colour_themes.conf(官网,Github)运行cb_share_config程序(codeblocks的安装目录后双击cb_share_config.exe)弹出的面板中,第一个位置打开下载的colour_themes.conf(1),第二个位置打开目标配置文件default.conf(2)(C:\Users\用户名\AppData\Roaming\CodeBlocks)。点击左下角的Transfer>>(3),然后再..
2021-07-11 16:20:30
1767
原创 Educational Codeforces Round 109 (Rated for Div. 2)
D. ArmchairsExamplesinput71 0 0 1 0 0 1output3input61 1 1 0 0 0output9input50 0 0 0 0output0思路dp[i][j] 表示 前i个人在前j个椅子中能取到的最小值代码ll n, m;ll s[100005], t[100005], ss, tt;ll dp[5003][5003];#define rep(i, a, b) for(int i=a;i<=b;++i)
2021-07-07 20:49:17
98
原创 Codeforces Round #727 (Div. 2)
C. Stable GroupsExamplesinput8 2 31 1 5 8 12 13 20 22output2input13 0 3720 20 80 70 70 70 420 5 1 5 1 60 90output3ll n, k, x;ll s[200005];ll t[200005], cnt;void work(){ cin>>n>>k>>x; for(int i=1;i<=n;++i){ cin>
2021-07-03 20:59:56
118
原创 Codeforce Educational Codeforces Round 108 (Rated for Div. 2)
D. Maximum Sum of Productstime limit per test2 secondsmemory limit per test256 megabytesinput standard inputoutpu tstandard outputYou are given two integer arrays a and b of length n.You can reverse at most one subarray (continuous subsegment) of the
2021-05-06 16:42:40
175
原创 D. GCD of an Array
D. GCD of an ArrayYou are given an array a of length n. You are asked to process q queries of the following format: given integers i and x, multiply ai by x.After processing each query you need to output the greatest common divisor (GCD) of all elements
2021-03-17 21:37:55
210
原创 K-beautiful Strings
You are given a string s consisting of lowercase English letters and a number k. Let’s call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the l
2021-03-17 21:19:12
239
原创 CodeForces - 1185D
CodeForces - 1185D题意:删除一个数字使排序后的数组呈等差数列思路:先排序,然后记录差值,然后对于每一个数字都考虑其对差值的影响,如果删除它导致差值的种类减少到1个,即结果。#include <bits/stdc++.h>using namespace std;#define maxn 200005#define show(k) cout<<k<<endlint s[maxn];int ss[maxn];map<int, int&
2021-03-07 21:05:48
118
原创 CodeForces - 1442B
题目Exampleinput35 31 2 3 4 53 2 54 34 3 2 14 3 17 41 4 7 3 6 2 53 2 4 5output204Note题意:两行数字,每一行都不存在重复数字;一种操作:任意选择一个数字,然后选择它左边或者右边的一个数字(下标满足 1-n)添加到数组b(初始为空)的最后,之后删掉这个数字(删除后右边的数字依次左移补齐),要求最后获得和第二行数字一样的排列问:一共有多少种方法;思路:首先:对于一个数字a,如果它
2021-01-25 10:36:13
164
1
原创 CodeForces - 1451D
题目Exampleinput52 15 210 325 415441 33outputUtkarshAshishUtkarshUtkarshAshishNote题意:有一个半径为n的圆,有两个人A (Ashish)和U (Utkarsh),A先走,每次可以向上或向左走k的路程问:最后谁不能再继续走了(输出的是赢家)思路想通一件事:你可以在45度的那条线上来回徘徊,类似于楼梯,当走到一个最接近的x 时,输赢就决定了代码#include <ki
2021-01-25 10:18:19
150
原创 Codeforce-Gym - 102861L-暴搜
题目Examplesinput4 5XBOICDKIRAALBOABHGES3BOLACASABOIoutput3input3 3AABABABAA2ABABBBoutput3input2 4AAAAAAAA2AAABBBoutput0题意给你一个二维矩阵,里面放着大写字母,给你n个单词(严格来说并不是),你需要在矩阵中找到尽量多的单词块,单词块中的各各字母的个数与其中一个单词相同;问:存在某些小方格,里面的字母被多个(>1)单
2021-01-24 22:04:40
313
1
原创 B-Mine Sweeper II
2020 ICPC 上海站 B原题链接:https://ac.nowcoder.com/acm/contest/10330/B其实这道题,只要相通一件事情,就可以了。(一个地雷对于他对他周围的空白格的影响) 等价于 (把他周围的空白格都变成雷,自己变成空白格的的影响),也就是说,这个把这个图置反(雷变空白,空白变雷),和原图其实是一样的。且题目说,最多可以进行 mn/2 次转换操作,那么B图必然可以转化成A图或A的反(这个应该称为补图吧),也就是说,不存在 -1 的情况,所以只要把补图求出来,然
2020-12-18 20:53:26
1127
4
原创 Magic Potion
2018 ICPC 南京站Problem I. Magic PotionInput file: standard inputOutput file: standard outputThere are n heroes and m monsters living in an island. The monsters became very vicious these days,so the heroes decided to diminish the monsters in the island. H
2020-12-18 10:42:46
258
原创 ZJNU 1361
树上两点最远距离 #include <bits/stdc++.h> using namespace std; const int bsz=1<<18; char bf[bsz], *head, *tail; inline char gc(){ if(head==tail){ int l=fread(bf,1,bsz,stdin); tail=(head=bf)+l;} return *head++;
2020-10-29 13:32:11
131
原创 食物链
标题食物链——中高级Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是“1 X Y”,表示X和Y是同类。第二种说法是“2 X Y”,表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话
2020-08-30 12:35:41
103
原创 HDU 6867 Tree
题目Problem DescriptionYou are given a tree consisting of n vertices numbered 1 to n rooted at node 1. The parent of the i-th vertices is pi. You can move from a vertex to any of its children. What’s more, you can add one directed edge between any two diff
2020-08-19 20:50:49
176
原创 RACE
RACEDescpription:Bessie is running a race of lenth K(1 <= K <= 1e9) meters.She starts running at a speed of 0 meters per second.In a given second,she can either increase her speed by 1 meter per second and run 1 meter ,or keep it at 0 meters per se
2020-07-08 01:18:19
166
原创 Ants
题目:n只蚂蚁以每秒 1 cm的速度在长为 L cm的杆子上爬行。当蚂蚁爬到杆子的端点是就会掉落。由于杆子太细,两只蚂蚁相遇时,它们不能交错通过,只能各自反向爬回去。对于每只蚂蚁,我么知道它等于距离杆子左端的距离x1,但不知道它当前的朝向。请计算所有蚂蚁落下杆子所需的最短时间和最长时间限制条件:1 << L << 10^6 , 1 << n <&l...
2020-02-23 15:48:55
968
原创 n根棍子组成三角形( nlog(n) )
三角形题目:有n根棍子,棍子i的长度为ai。想要从中选出3根棍子组成周长尽可能长的三角形。请手输出最大的周长,若无法组成三角形,则输出0。输入:5 2 3 4 5 10 输出:12(选3,4,5)输入:4 4 5 10 20 输出:0(无法组成三角形)理解:就是找一个周长最长的三角形组成三角形的条件:两短边之和大于第三边O(n^3):当n的规模不是很大时候,暴力求解法就可以了...
2020-02-23 14:42:21
2011
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人