- 博客(141)
- 问答 (3)
- 收藏
- 关注
原创 解决导入vue项目的node版本与本地环境不一致
没有yarn需要先使用npm install -g yarn。出现上面这个错误,在项目根目录进入命令行输入下面这条指令。自动导入依赖输入yarn install。
2023-08-12 18:46:52
770
原创 牛牛的数列
https://ac.nowcoder.com/acm/problem/13134解题思路:a表示数列,dp表示到当前位置的严格递增子序列长度,例如下面这个例子a : 7 2 3 1 5 6dp:1 1 2 1 2 3仔细观察,发现有两种情况第一种情况就是断点前的数改变(例如7 2 3,其中的2就是断点,代码表示i-dp[i]+1)如果断点前面的那个数改变,并且能够小于断点的值,还要两段和起来子序列仍然保持严格递增的,那么这两个子序列就可以连接起来,转换成代码就是 a[i-dp[i]+1]
2022-05-18 16:23:17
331
1
原创 牛客上海理工大学选拔赛D
思路:看到数据大小想到dfs肯定暴了,看题中给的数列,化成二进制,发现与n有某种关系,剩下的就可以敲代码了。。一般看到这样的数据大小要先想到位运算#include <iostream>#include <algorithm>#include <map>#include <set>#include <string>#include <sstream>#include <vector>using names.
2022-03-26 17:36:07
320
原创 牛客(基础位运算)起床困难症
这道题有个问题希望有大佬能解答一下,(在后面,下面思维表达不太好,大家忽喷)采用贪心策略,题目要我们从0-m中选一个数使得经过一系列位运算后的结果最大那就分别用两个bitset表示每一位初始为0,每一位初始为全1,方便下面表示一个用zero,一个用one表示zero,one根据输入的数据都进行相应的位运算考虑zero全0时,初始值就不会超过m,经过位运算后,那就把不为0的位化成十进制加到答案上如果zero第i位上为0,one第i位上为1就要看(1<<i)<=m满不满足,满足也把.
2022-03-23 22:06:57
325
原创 牛客最短哈密顿路径(位运算)
通过dp位运算来解决思路:第一想到状态dp,用二进制位表示每个节点那么(1<<n) -1表示全1情况也就是包含所有节点dp[1<<n][n]第一维表示走过0,1,2,3.。。。。n-1个点的所有情况第二维表示最后一个点到达的的点弄清楚这几点之后代码就很简单了菜鸡的我想不到,只能看大佬的题解。。#include <iostream>#include <algorithm>#include <cstring>using nam
2022-03-21 17:00:00
231
原创 64位数相乘
诶,我怎么没想到把一个数分解成二进制,再用二进制化十进制的方法相加,那不就等于一个数乘以多个数了嘛,就不会越界了,,,还傻乎乎的开平方找约数。。。。#include <iostream>#include <cmath>using namespace std;typedef long long ll;ll x,y,mod;int main(){ ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(
2022-03-20 21:02:00
288
原创 牛客练习赛97_D
…深搜老以为会爆。。#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N = 1000010;const ll mod = 998244353;struct edge{ int to,next;}edges[N<<2];int head[N],tot=0;int n;ll x,y;void add(int u,int v){ edges[++.
2022-03-13 21:58:09
273
原创 牛客练习赛97_C
比赛时题意没理解到位,没想到 vt.push_back(-p[j] - max(a[j],0));这一步。。#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef long long ll;const int N = 100010; int a[N],p[N],b[N];int main(){ ios_base::sync_wi.
2022-03-11 22:54:17
515
原创 湖南ACM第6届D
在平面直角坐标系下,台球桌是一个左下角在(0,0),右上角在(L,W)的矩形。有一个球心在(x,y),半径为R的圆形母球放在台球桌上(整个球都在台球桌内)。受撞击后,球沿极角为a的射线(即:x正半轴逆时针旋转到此射线的角度为a)飞出,每次碰到球桌时均发生完全弹性碰撞(球的速率不变,反射角等于入射角)。如果球的速率为v,s个时间单位之后球心在什么地方?Input输入文件最多包含25组测试数据,每个数据仅一行,包含8个正整数L,W,x,y,R,a,v,s(100<=L,W<=105, 1<
2022-03-02 21:48:15
164
原创 求星期几~~~~~~
从公元1年1月1日开始计算多少天,最后模除7,0表示星期天#include <iostream>using namespace std;int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};int run(int y){ return ((y%4==0 && y%100!=0)||y%400==0);}int howmany(int y,int m,int d){ int ans = 0; for(
2022-03-01 20:39:06
102
原创 并查集(模板)
const int N = 1000010;int f[N];void init_set(int n){ for(int i = 1;i<=n;i++) f[i] = i;}int find_set(int x){ if(f[x] != x) return f[x] = find_set(f[x]); return x;}void merge_set(int x,int y){ x = find_set(x),y = find_set(y); if(x != y) f[x
2022-02-28 20:17:25
95
原创 湖南第六届C
定理: 把一个至少两位的正整数的个位数字去掉,再从余下的数中减去个位数的5倍。当且仅当差是17的倍数时,原数也是17的倍数。例如,34是17的倍数,因为3-20=-17是17的倍数;201不是17的倍数,因为20-5=15不是17的倍数。输入一个正整数n,你的任务是判断它是否是17的倍数。Input输入文件最多包含10组测试数据,每个数据占一行,仅包含一个正整数n(1<=n<=10100),表示待判断的正整数。n=0表示输入结束,你的程序不应当处理这一行。Output对于每组测试数据,
2022-02-26 11:19:30
147
原创 蓝桥杯11_平面切分
在做这题的想到的是平行和相交以及重合的几种关系,两条线平行是会多出一个面,相交时会多出两个面,重合时不会增加面,第一次做的时候只考虑了每两条线之间的这些关系。正确做法应该是考虑交点,写几个例子会发现是多出来的面正好是交点数+1#include<iostream>#include <set>using namespace std;int main(){ int n; cin >> n; pair<long double,long double.
2022-02-25 20:48:40
466
原创 蓝桥杯11——子串分值和
找规律,思维先考虑不重复的情况abcde在考虑重复的情况ababc写一下找出规律就可以发现结论了看代码#include<iostream>#include <string>using namespace std;int pre[100];int main(){ string str; cin >> str; int len = str.length(); str = " " + str; long long ans = 0; for.
2022-02-25 01:27:21
7831
原创 蓝桥杯12-货物摆放
思路:首先要想到,一个数n能被哪些数除这个数开平方以内的数i,而另外一部分就是n/i#include <iostream>#include <cmath>using namespace std;typedef long long ll;int main(){ ll num = 4; ll a[10005]; int n = 0; for(int i = 1;i<=sqrt(num);i++){ if(num%i == 0){ if(num.
2022-02-06 22:47:53
8364
原创 蓝桥杯12-直线
思路:第一点要想到y=kx+b两条直线的k和b不相同那么这两条直线不相同直接暴力4重循环要把斜率不存在的直线特判出来,最后结果加上就好了#include<iostream>#include<algorithm>#include <cmath>#include <map>using namespace std;struct L{ double k,b; int operator < (const L& ll) con.
2022-02-03 23:52:33
6755
原创 紫书习题3-8循环小数
题目:https://www.luogu.com.cn/problem/UVA202思路首先要搞清楚怎么确定循环小数的位数,这点要根据被除数是否相等确定剩下的就是把a/b的每一个结果存到数组里面,最多存五十位就够了(题目要求)最后就是按格式输出#include<iostream>#include<cstring>using namespace std;int ans[100],num[30010];int main(){ int a,b; while(s
2022-02-02 23:26:22
556
原创 紫书习题3-6纵横字谜的游戏
题目:https://www.luogu.com.cn/problem/UVA232看题目直接点链接。。想了好多办法结果都有问题,在这张的题里面主要用数组,,思维太差了。。#include<iostream>#include<cstring>using namespace std;// 行号,列号,样例号,字母序号,行下标,列下标,用于临时遍历的列下标,上一个单词访问完后的位置 int r,c,count=1,t,i,j,k,pr;char g[11][11];//网
2022-02-01 22:49:58
2216
原创 D. Array and Operations
题目:https://codeforces.com/contest/1618/problem/DYou are given an array a of n integers, and another integer k such that 2k≤n.You have to perform exactly k operations with this array. In one operation, you have to choose two elements of the array (let the
2021-12-15 17:03:00
434
原创 四川大学(新生赛)羊工八刀(为解决)
题目:https://ac.nowcoder.com/acm/contest/25625/E#include <bits/stdc++.h>#define int long longusing namespace std;const int maxn=1e6+5;const int mod=1e9+7;int t,n,cnt;char a[maxn];vector<int> v;int sum[maxn];signed main(){ cin>&
2021-12-12 20:21:41
656
原创 四川大学(新生赛)papaya的传送门
题目:https://ac.nowcoder.com/acm/contest/25625/L解题思路:这就是一道水题。。。求出点到圆心的距离,然后减去半径就是从起点到机场的距离d,需要判断当前是否在机场,还有就是k是否大于d,如果大于那么就需要两次传送,第一次到一个机场外的点,第二次从这个点到机场。,如果k<d,那么直接d/k,如果有小数,那么答案再加1#include <iostream>#include <cmath>using namespace std;
2021-12-12 20:16:50
502
原创 逆元知识(含模板)
为了解决下面出现除法的情况,要用逆元费马小定理求解:需要搭配快速幂来求解扩展欧几里得算法:主要用于求解不定方程定义:对于已知a,b,必然存在ax+by=gcd(a,b)#include<iostream>using namespace std;void exgcd(int a,int b,int &x,int &y){ if(b==0) { x=1; y=0; return; }
2021-12-08 10:20:54
215
原创 2021CPC_C_Average of Two Numbers
题目:https://cpc.csgrandeur.cn/csgoj/problemset/problem?pid=1159DescriptionGiven a list of n different numbers, which number in this list can be represented as an average of any two other numbers in the same list?InputThere are multiple test cases.The f
2021-12-06 22:06:49
579
原创 SCOI2005最大子矩阵和
题目:https://ac.nowcoder.com/acm/problem/20242链接:https://ac.nowcoder.com/acm/problem/20242来源:牛客网题目描述这里有一个n*m的矩阵,请你选出其中k个子矩阵,使得这个k个子矩阵分值之和最大。注意:选出的k个子矩阵 不能相互重叠。输入描述:第一行为n,m,k(1 ≤ n ≤ 100,1 ≤ m ≤ 2,1 ≤ k ≤ 10),接下来n行描述矩阵每行中的每个元素的分值(每个元素的分值的绝对值不超过32767)。
2021-11-28 23:13:16
220
原创 NC23486(小A和小B)
题目:https://ac.nowcoder.com/acm/problem/23486链接:https://ac.nowcoder.com/acm/problem/23486来源:牛客网题目描述小A与小B这次两个人都被困在了迷宫里面的两个不同的位置,而他们希望能够迅速找到对方,然后再考虑如何逃离迷宫的事情。小A每次可以移动一个位置,而小B每次可以移动两次位置,小A移动的方向是上下左右左上左下右上右下8个方向,小B移动的方向是上下左右4个方向,请问他们最早什么时候能够找到对方,如果他们最终无法相遇,
2021-11-27 20:53:32
338
原创 A. Exciting Bets
题目:https://codeforces.com/contest/1543/problem/AWelcome to Rockport City!It is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet a dollars and Ronnie has bet b dollars. But the fans seem to be disappoint
2021-11-26 09:54:51
198
原创 Codeforces_A_114party
题目:https://codeforces.com/contest/115/problem/AA. Partytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA company has n employees numbered from 1 to n. Each employee either has no immediate manager
2021-10-27 18:21:28
219
原创 Nastya and Rice
题目:https://codeforces.com/problemset/problem/1341/A思路:判断两个集合是否有交集做题过程中犯的错误是只考虑了一种情况。。#include <bits/stdc++.h>using namespace std;int main(){ int t; cin >> t; while(t--){ int n,a,b,c,d; cin >> n >>
2021-09-25 13:06:43
98
原创 B. Construct the String
题目:https://codeforces.com/problemset/problem/1335/B构造题,没摸清规律AC代码:#include <bits/stdc++.h>using namespace std;int main(){ int t; cin >> t; while(t--){ int n,a,b; cin >> n >> a >> b; f
2021-09-23 21:33:33
73
原创 KDTree模板
这一块知识点也不太好理解。。看了几个小时,大概是懂了,用于范围搜索确实可以提高不少效率这里有个模板题:https://anoxiacxy.github.io/more/bzoj/p/2648.html上面那个是二维的,这个算法可以搜索多维的这里有个讲的还可以https://leileiluoluo.com/posts/kdtree-algorithm-and-implementation.html。。主要理解图,就是关于搜索范围这里可能不太好理解,在代码里面可能有点模糊下面是上面那个模板题的模板代码
2021-08-23 17:40:57
238
原创 虚树模板(用到lca)
虚树这一个知识点刚开始看都摸不清头脑,集中精力看了一个多小时发现原来挺简单的,可能是理解了的东西都会觉得简单吧。。这边有位大佬写的可以–》》https://www.cnblogs.com/chenhuan001/p/5639482.html不过它的这个lca我觉得没我的清晰。。可能是我太菜了,看不懂他优化了的吧。。下面是我写的模板:#include <bits/stdc++.h>using namespace std;const int N = 10010;struct edge{
2021-08-21 16:50:05
135
原创 伸展树模板
题目链接:https://www.luogu.com.cn/problem/T142843伸展树这块知识要掌握左旋和右旋,以及splay中四种调用左旋右旋的情况,通过伸展会把x节点提升至根节点的位置,理解了这些差不多就会了。这里有个大佬也写了——》https://www.luogu.com.cn/paste/k0h4zdjy下面是我把实现的模板//题目:https://www.luogu.com.cn/problem/T142843//参考代码:https://www.luogu.com.cn/p
2021-08-19 17:46:17
183
原创 树链剖分+线段树模板
模板题链接:https://www.luogu.com.cn/problem/P3384这个树剖的知识点不难,只要理解了什么是重链,怎么把一棵树重新编号,让它满足建成一颗线段树的线性条件,那么就很容易了,我打了两边,第一遍那个查询区域和修改区域的地方错了,第二次也是这块区域出了点小问题,还有线段树更新里面最后那里忘记重新计算和了。。下面是我第一次打的模板,嗯~整体结构一般吧。。#include <bits/stdc++.h>using namespace std;typedef lo
2021-08-19 17:05:21
138
原创 HDU6106(容斥问题)
题目:https://acm.hdu.edu.cn/showproblem.php?pid=6106思路:把题目给的七个数据画出文氏图,根据容斥定理就可以算出每个班的人数AC代码://容斥定理,把那个三集合的文氏图画出来就求出解了#include <bits/stdc++.h>using namespace std;int main(){ int n,t; int a[8]; scanf("%d",&t); while(t--){
2021-08-17 13:07:54
79
原创 数论容斥定理+鸽舍定理
容斥定理理论:模板例题:这应该是一道入门题思路:把三个数的整数看成三个集合,然后根据上面那个文氏图就可以求出来#include <iostream>#include <stdio.h>#include <stdlib.h>using namespace std;/*题目:电灯泡有编号1-n个灯泡,每个灯泡有个开关1.所有灯泡初始时不亮的2.小白分别进行三次操作3.每次操作选了一个质数x,将x和x的倍数开关都驱动一下,如果灯泡亮的那么就改成不
2021-08-16 17:42:08
181
原创 矩阵快速幂模板+例题
相关知识学习往这边–》https://blog.youkuaiyun.com/wust_zzwh/article/details/52058209搞懂了模板想怎么写就怎么写,看个人整数快速幂模板:#include <iostream>#include <stdio.h>#include <stdlib.h>using namespace std;long long fastpow(int x,int n){ long long ans = 1; lo
2021-08-15 18:10:49
225
原创 回文树模板(不太好理解)
这个算法又花了六七个小时,不能说完全掌握了,只能说原理基本上懂了,模板基本上也懂了,还要很多地方需要去琢磨。。这个知识点可以看视频,我推荐的是b站的–》Clever_jimmy ,这个作者讲的很好模板题:https://acm.hdu.edu.cn/showproblem.php?pid=5658代码:#include <iostream>#include <stdio.h>#include <string.h>#include <stdlib.
2021-08-14 19:23:04
179
原创 后缀数组模板(难)
后缀数组真不太好理解,虽然看图可以理解就是一个基数排序,但是自己写总是出问题,这是迄今为止可以算遇到的第一个比较难懂的算法,学习后缀数组可以看这篇论文-》https://wenku.baidu.com/view/ed1be61e10a6f524ccbf85fd.html模板题:http://poj.org/problem?id=1743代码:#include <iostream>#include <stdio.h>#include <string.h>#inc
2021-08-14 10:22:27
97
空空如也
红黑树的插入删除等操作,代码写的很详细但是出现段错误,不知到错在哪
2021-08-10
求大佬帮忙解决codeforces 中的Two sequences,为什么我这样过不了
2021-05-28
如何求出整数因子分解式并输出
2021-03-10
TA创建的收藏夹 TA关注的收藏夹
TA关注的人