- 博客(13)
- 收藏
- 关注
原创 第十届蓝桥杯A组:试题 I: 糖果
思路:bfs+状压?代码:#include<bits/stdc++.h>using namespace std;int g[100][100];int vis[10000007];int n,m,k;vector<int>v[10000];struct node{ int ss,step;};int bfs(){ memset(vis,...
2019-04-05 11:35:02
905
转载 python3 文件读取
解决Python读取文件时出现UnicodeDecodeError: 'gbk' codec can't decode byte...用Python在读取某个html文件时会遇到下面问题:出问题的代码:1 if __name__ == '__main__':2 fileHandler = open('../report.html', mode='r')3 4 ...
2018-12-29 09:58:17
205
原创 【KMP】 专题
HDU 1711#include<bits/stdc++.h>#define maxn 1000005using namespace std;int a[maxn],b[maxn];int tlen,slen;int nxt[maxn];void getNext(){ int j=0,k=-1; nxt[0]=-1; while(j<tlen) { ...
2018-08-05 15:08:49
253
原创 CCF 碰撞的小球(暴力枚举)
#include<bits/stdc++.h>using namespace std;int n,L,t;vector<int>vis[3000];map<int,int>dict;int to[3000];int find(int k){ for(int i=0;i<=L;i++) { vis[i].clear(); } for(int i=1;i&...
2018-07-12 19:31:33
796
原创 POJ 1236
#include <map>#include <set>#include <queue>#include <stack>#include <vector>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>#include <algorith
2018-07-01 10:46:09
176
原创 HDU3836 (求至少加几条边使其强连通分量为1)
Problem DescriptionTo prove two sets A and B are equivalent, we can first prove A is a subset of B, and then prove B is a subset of A, so finally we got that these two sets are equivalent.You are to ...
2018-06-30 19:14:57
230
原创 Tarjan算法
1.求有向图强连通分量个数 1.1vector模板#include<stdio.h>//此代码仅供参考,用于求一个图存在多少个强连通分量#include<string.h>#include<vector>#include<algorithm>using namespace std;#define maxn 10000+5vector...
2018-06-29 14:06:34
183
原创 HDU 1269 (Tarjan算法求有向图中强连通分量数目)
#include<bits/stdc++.h>#define maxn 10000+5using namespace std;vector<int>mp[maxn];int vis[maxn],dfn[maxn],low[maxn];int n,m,cnt,sig;void init(){ memset(low,0,sizeof(low)); memset(dfn,0,sizeof(dfn)); memset(vis,0,sizeof(vis)); for(i
2018-06-29 14:04:10
285
原创 字典树模板
数组模板#include<bits/stdc++.h>#define maxn 1<<20using namespace std; int ch[maxn][26],cnt[maxn];int id;void insert(char *str){ int rt = 0; int len = strlen(str); for...
2018-06-28 14:21:13
206
原创 计蒜客OJ:跳跃游戏(动态规划)
https://nanti.jisuanke.com/t/18给定一个非负整数数组,假定你的初始位置为数组第一个下标。数组中的每个元素代表你在那个位置能够跳跃的最大长度。请确认你是否能够跳跃到数组的最后一个下标。例如:A=[2,3,1,1,4]A = [2,3,1,1,4]A=[2,3,1,1,4] 能够跳跃到最后一个下标,输出true;A=[3,2,1,0,4]A = [3,2,1,0,4]A=...
2018-04-16 17:25:13
395
原创 计蒜客OJ:程序设计:取石子(博弈论)
题目链接:https://nanti.jisuanke.com/t/25083题目:蒜头君和花椰妹今天都很无聊。两个人相约一起玩游戏。蒜头君取出了一堆奇形怪状的石子,并且把它分成了三堆。他和花椰妹轮流从里面取石子,取出最后一颗石子的人胜利。花椰妹觉得这样没意思,于是她要求加入一个限制条件:每个人每次只能取出 1,3,71,3,7 或 99 颗石子。石子数目不够的时候不能多取,如还剩 22 颗石子的...
2018-04-13 20:33:09
828
原创 CCF 201703-4 地铁修建(spfa)
#include<iostream>#include<cstring>#include<queue>#include<algorithm>#define INF 0x3f3f3f3f #define maxn 2000000using namespace std;using namespace std; int dis[maxn];//储存起点到当前点的最短路 int v
2018-01-04 22:09:39
329
原创 201709-2 公共钥匙盒 解题报告
#include<iostream>#include<algorithm>#include<vector>using namespace std;vector<int>in,out;//in为储存还钥匙的编号的容器,out为储存借钥匙的编号的容器 int n,m;int a[10000];struct key{ int w,s,c,e;//w为钥匙编号,s为上课起始时间,c为上
2017-12-22 13:27:39
1529
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人