自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 收藏
  • 关注

原创 统计不同excel关键字的数据之和

python操作excel

2022-08-28 19:02:27 262 1

原创 2021-08-24

Problem - 1000 Online Judge Online Exercise Online Teaching Online Contests Exercise Author F.A.Q Hand In Hand Online Acmers <!--<a href="" style="text-decoration: none">Forum | </a><a h

2021-08-24 20:22:54 124

原创 并查集

#include<bits/stdc++.h>using namespace std;int f[10010];int pf[10010];int n,m,c,d,t;int find(int x)//查找祖宗{ return f[x] == x ? f[x] : f[x]=find(f[x]);}void join(int x,int y)//合并集合,y合并到x中{ f[find(y)]=find(x);}bool cmp(int x,int y)//判断两个点是否

2021-08-24 18:02:25 108

原创 哈希函数 (处理字符串)

POJ 2752: Seek the Name, Seek the Famproblem: http://poj.org/problem?id=2752把每个前缀和后缀相同的位置都输出Input:ababcababababcababaaaaaOutput:2 4 9 181 2 3 4 5Code:#include<iostream>#include<cstring>#include<cstdio>#define rep(i,s,n)

2021-08-24 09:04:17 143

原创 KMP

void get_next(){ next_[0]=-1; i=0,k=-1; while(i<m) { if(k == -1 || b[i] == b[k]) next_[++i] = ++k; else k = next_[k]; }}int kmp(){ n = strlen(a); m = strlen(b); get_next(); i=0,j=0; count=0; while(i<n) { if(j == -1 || a[i] == b

2021-08-17 14:53:06 65

原创 树的直径 (最长路径)

POJ:http://poj.org/problem?id=1383Vjudge:https://vjudge.ppsucxtt.cn/contest/452794#problem Password:HPU605Question最长联通的 ’ . ’ 的个数减一Sample Input23 3####.####7 6########.#.####.#.####.#.#.##.....########Sample OutputMaximum rope length i

2021-08-13 09:44:26 77

原创 拓扑排序 ( TopSort )

拓扑排序时间复杂度:O(n+m)因每个结点只需加入队列一次,而每个结点加入队列前需要进行入度数量次的操作,因此时间复杂度为O(n+m)。无法排序?:当有 类似 0 → 1 ,且 1 → 0 ,或 1 → 2 , 2 → 3 ,3 → 1 ,的时候,会形成一个环,导致上一个队列中的元素被移走后,没有入度为0的点,导致 while( ! q.empty ( ) ) 终止,cnt < n核心算法 :void TopSort(){ for(int i = 1; i <= n; i+

2021-08-05 21:26:54 2059

原创 DFS BFS 模板

BFSBFS (Breath First Search)广度优先搜索 模板struct jgt{ int x; //横坐标 int y; //纵坐标 int step; //到这一点走的步数}int bfs(){ memset(vis,0,sizeof(vis)); //多组数据需要初始化数组 queue<jgt> q; jgt start,now,next; start.x=sx; //sx为开始点的横坐标 start.y=sy; //sy为开始点的纵坐标 st

2021-08-04 21:36:37 126

原创 二进制枚举

C - Skill UpTime Limit: 2 sec / Memory Limit: 1024 MBScore : 300300 pointsProblemTakahashi, who is a novice in competitive programming, wants to learn MM algorithms. Initially, his understanding level of each of the MM algorithms is 00.Takahashi is vi

2021-07-27 09:38:29 131

原创 最大公约数 最小公倍数

最大公约数(GCD)辗转相除法(欧几里得算法)int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}最小公倍数(LCM)最小公倍数=两数之积 / 最大公约数lcm(a,b) = a*b / gcd(a,b)int lcm(int a,int b){ return a*b/gcd(a,b);}...

2021-07-25 09:49:41 48

原创 快速幂 快速乘 矩阵快速幂

快速幂并取余typedef long long LL;ll Quuickpower(ll a,ll b,ll c){ ll res=1%c; //应对b=0,c=1的特殊情况 while(b) { if(b&1) res=res*a%c; a=a*a%c; b>>=1; } return res;}

2021-07-25 09:41:26 84

原创 素数筛(埃氏筛+欧拉筛)

埃氏筛const int N=1000001;bool isPrime[N];void aiPrime(){ memset(isPrime,1,sizeof(isPrime)); isPrime[1]=0; for(i=2;i<=1000000;i++) { if(isPrime[i]) { for(j=i*i;j<=n;j+=i) isPrime[j]=0; } }}欧拉筛const int N=1e6+5;int Prime[N];boo

2021-07-25 09:28:22 43

原创 对顶堆(大根堆+小根堆)优先队列

C - Running Median (HDU - 3282)For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements received so far.InputThe first line of i

2021-07-20 09:01:19 309

原创 大数相加(简单模拟)

1. A + B Problem II(HDU1002)#include<cstring> using namespace std;const int N=1010;int lenmax,lena,lenb,T,i,sum,jin=0,cnt=1;string A,B;int a[N],b[N],c[N];int main(){ cin>>T; while(T--) { cin>>A>>B; lena=A.size();

2021-07-17 10:14:33 51

原创 C++判断欧拉图

将无向图用矩阵的方式输入,判断其是欧拉图、半欧拉图还是普通图输入:40 1 1 01 0 0 11 0 0 10 1 1 0输出:欧拉图输入:40 1 1 11 0 0 11 0 0 11 1 1 0输出:半欧拉图输入:80 1 1 1 0 0 0 01 0 0 1 0 0 0 01 0 0 1 0 0 0 01 1 1 0 0 0 0 00 0 0 0 0 1 1 00 0 0 0 1 0 1 10 0 0 0 1 1 0 10 0 0 0 0 1 .

2021-05-20 17:25:40 1387 1

原创 STL基本函数

sort结构体排序:struct jgt{ string s,m,x,h; int id;}a[1000005];bool cmp(jgt f1,jgt f2){ if(f1.s.length()!=f2.s.length()) return f1.s.length()<f2.s.length(); else if(f1.s!=f2.s) //短的在前,同样长度按照字典序小的在前,同用户 return f1.s<f2.s; //名先输入的在前面 else .

2021-01-23 18:11:07 99

原创 算法

数字反转:(把数字前面的0自动过滤)int n; cin >> n; int r = 0; while ( n ) { r = r * 10 + ( n % 10); n /= 10; } cout << r;

2021-01-22 23:14:48 58

原创 字符串

gets()函数得到可包含空格的字符串,以回车结束;puts()函数输出字符串。

2021-01-21 20:50:52 83

原创 C++函数

cmath:ceil()向上取整 1.2 >>> 2floor()向下取整 1.2 >>> 1round()对浮点数四舍五入 1.4 >>> 1 , 1.5 >>> 2

2021-01-20 16:23:16 62

原创 题踢

十进制转换输入一个十进制数N,将它转换成R进制数输出。Input输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(2<=R<=16, R<>10)。Output为每个测试实例输出转换后的数,每个输出占一行。如果R大于10,则对应的数字规则参考16进制(比如,10用A表示,等等)。Sample Input7 223 12-4 3Sample Output1111B-11#include<iostream>using nam

2021-01-19 22:19:50 70

原创 C 优先级 ASCII码表 数据范围

int 数组当 N最大 = 536870911,5000万,5e8

2021-01-18 11:17:00 104

原创 小小知识点

while(n)//相当于while(n>0)

2021-01-11 19:13:12 97

原创 安装wordcloud库报错

我用半包辣条赌当你点开此链接时,你的wordcloud库安装失败了废话不多说,教程奉上:(在某哩某哩上看一大佬教程非常不错,可以点进https://www.bilibili.com/video/BV1bt4y1y7sU?t=319我在下面就把这位大佬的第一个方法详细补充一下,只是补充!!!详细教程还是要看这位大佬的!!!1:下载一个非官方wordcloud库,自己安装的是哪个版本python就下载哪个链接: https://pan.baidu.com/s/1YOCQNLgCeh0_reDxE

2020-12-28 11:28:31 701

原创 备忘录

!=EOF的使用在C语言中"scanf("%d",&n) != EOF"相当于"scanf("%d",&n) != EOF",或"~scanf("%d",&n)",或"scanf("%d",&n) == 1 "但是在C++中不存在这种用法,但相同作用的有while((cin >> a) != 0)作用:输入多个数据,以空格隔开,按回车键结束输入,输出结果,可进行下一组的输入。以空格输入的值都是单独的一项,每个输出对应一个以空格输入的值例子:#inc.

2020-12-24 20:08:32 135 1

原创 查知识点(供自己用的,有很多地方可能不对,忘大佬斧正小蒟蒻)

二分法查找#include<iostream>#include<cstdio>using namespace std;int a[1000005];//二分函数在此int erfen(int T[],int gei,int num){ int left,right,mid; left=0; right=num-1; while(left<=right) { mid=(right+left)/2; if(gei==T[mid]) return

2020-12-20 21:19:20 152

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除