- 博客(51)
- 收藏
- 关注
原创 unity连接mysql数据库
1.首先你需要安装mysql数据库,我装的是最新版的8.0的数据库。没有的可以去这个链接下载https://dev.mysql.com/downloads/mysql/2.需要下载mysql.data的动态链接库文件链接:https://pan.baidu.com/s/1vlVBuUW9k3vNsaCQ-RCHPg提取码:2zqm复制这段内容后打开百度网盘手机App,操作更方便哦3.将...
2019-12-17 16:45:28
1348
2
原创 fzu-2216
Problem 2216 The Longest StraightAccept: 178 Submit: 536 Time Limit: 1000 mSec Memory Limit : 32768 KBProblemDescriptionZB is playing a card game where the goal is to makestraights. Each ...
2018-04-24 10:40:22
229
原创 51nod--1437
1347 旋转字符串 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 S[0…n-1]是一个长度为n的字符串,定义旋转函数Left(S)=S[1…n-1]+S[0].比如S=”abcd”,Left(S)=”bcda”.一个串是对串当且仅当这个串长度为偶数,前半段和后半段一样。比如”abcabc”是对串,”aabbcc”则不是。 现在问题是给定一...
2018-04-03 11:35:46
197
原创 最大公约数--最小公倍数
#include<cstdio>#include<cstring>int zdgys(int a,int b)//辗转相除法 { int t; while(b) { t=b; b=a%b; a=t; } return t;}int zxgbs(int a,int b)//两个数的最小公倍数== 两个数相
2017-12-05 21:15:04
235
原创 表达式求值(单位运算)--栈
#include<cstdio>#include<iostream>#include<cstring>using namespace std;typedef int Status;typedef struct StackNode{ char date; struct StackNode *next;}StackNode,*LinkStack;Status Initst
2017-11-06 17:30:03
328
原创 畅通工程--并查集(水)
Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应
2017-10-24 17:21:54
235
原创 pat1008
数组元素循环右移问题 (20)时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0 A1……AN-1)变换为(AN-M …… AN-1 A0 A1……AN-M-1)(最后M个数循环移至最前面的M个位置
2017-09-17 18:49:59
247
原创 ZZTI1000
问题 A: 序号互换 时间限制: 1 Sec 内存限制: 128 MB 提交: 241 解决: 95 [提交][状态][讨论版] 题目描述Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB
2017-09-17 18:23:23
324
原创 畅通工程--并查集(水)
Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应
2017-08-23 10:12:57
239
原创 字典树
#include<cstdio>#include<cstring>#include<algorithm>#define idx(x) (x-'a')using namespace std;int n,m; //输入字符串数 查询次数 int ant; //记录当前在哪一层 struct Node{ int v; //当前有多少个字符串共用这个数组
2017-08-22 20:41:11
217
原创 zzuli2177
Description平时大家都爱吃零食,但是大家知道吗?这些零食中大多数都是垃圾食品,它对我们身体的危害是很严重的。 最近,赵老师在进教室时常常闻到一股怪味,觉得有同学在吃垃圾食品,老师就开始查,果然,有个同学在吃辣条。于是,赵老师在班上举行了一次讨论会,要大家就“垃圾食品危害健康”这问题发表看法。 讨论会开始了,有的同学介绍了垃圾食品的危害,有的提醒我们不要去买,还有的说了垃圾食品的特点。
2017-08-22 15:07:16
238
原创 大数求阶乘
#include<cstdio>#include<cstring>using namespace std;int a[10000];int main(){ int n; scanf("%d",&n); memset(a,0,sizeof(a));//初始化 a[1]=1; int len=1; for(int i=1;i<=n;i++)
2017-08-16 20:09:52
188
原创 树状数组--一维模板
树状数组不是很懂只能给个模板了。 原理是二分法。#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int tree[100005];int n;int lowbit(int x){ return x&(-x);}void add(int x,int y){ while(
2017-08-16 15:56:48
228
转载 树状数组--转
传送门第01讲 什么是树状数组?树状数组用来求区间元素和,求一次区间元素和的时间效率为O(logn)。有些同学会觉得很奇怪。用一个数组S[i]保存序列A[]的前i个元素和,那么求区间i,j的元素和不就为S[j]-S[i-1],那么时间效率为O(1),岂不是更快?但是,如果题目的A[]会改变呢?例如:我们来定义下列问题:我们有n个盒子。可能的操作为1.向盒子k添加石块2.查询从盒子i到盒子j总的石块数
2017-08-16 15:16:19
197
原创 dp--矩阵取数问题
矩阵取数:给你一个正方形矩阵,有左上角走到右下角所经过足迹的最大和。(只能向前或向下).#include<cstdio>#include<algorithm>#define INF 0x3f3f3f3fusing namespace std;int a[505][505]={0};int dp[505][505]={0};int main(){ int n; scan
2017-08-15 15:50:46
193
原创 dp--正整数分组
正整数分组:使一个正整数数组分成两个数组且这两个数组和相差最小, 输出这个最小差.#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int dp[5050*2]={0};int a[110];int main(){ int n; int sum = 0; int m;
2017-08-15 15:47:26
310
原创 dp--编辑距离
编辑距离:使一个字符串变成另一个字符串所需要的最少步骤.#include<cstring>#include<cstdio>#include<algorithm>using namespace std;char str1[1010];char str2[1010];int dp[1010][1010];//表示s的前i位和t的前j位对齐扣得最少的分 int main(){ sc
2017-08-15 15:44:01
159
原创 矩阵(加法&&乘法&&快速幂)
矩阵相乘:#include<cstdio>int main(){ int m1,m2,n1,n2; int t; int a[105][105]; int b[105][105]; int c[105][105]; scanf("%d",&t); while(t--) { scanf("%d%d",&m1,&n1);
2017-08-15 15:39:50
387
原创 KMP算法
#include<cstdio>#include<cstring>int next[100];char a[100];char b[100];void getnext(char *t,int n)//next数组表示前缀子串和后缀子串的最大重和的长度 { //例如:a b a b a int j=0,i=0;
2017-08-15 15:28:31
186
原创 线段树--数据结构(建树,查询区间和&&最大值&&最小值)
代码模板:#include<cstdio>#include<algorithm>using namespace std;struct Node{ int l,r,sum,Max,Min;}Tree[1000<<2];void PushUp(int o){ Tree[o].sum = Tree[o*2].sum + Tree[o*2+1].sum; Tree[o]
2017-08-12 10:29:43
684
原创 QAQ & 火星情报局
QAQ~超级喜欢看火星情报局,每周六都是他一周中最期待的一天,QAQ喜欢和自己一样心愿是“世界和平”的薛之谦,喜欢“一言不合就飙车”的宇哥,喜欢“再扯的提案都能升华为鸡汤”的汪涵局长….当然也喜欢的里面各种各样奇葩有趣的提案…..最近 K 星颁布了一项新的法律,所有 K 星的公民必须缴纳的所得税是收入 money 的最大因子 o 且 ( o≠moneyo \not= money ) ,做为一名 AC
2017-08-11 19:20:26
523
原创 LIS&&LCS
LCS:#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<stack>#define INF 0x3f3f3f3fusing namespace std;int main(){ char str1[55]; char str2[55]; scanf("%s %
2017-08-09 15:38:24
282
原创 免费馅饼--DP
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝,
2017-08-08 16:26:42
144
原创 最少拦截系统
Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了
2017-08-08 16:17:38
173
原创 LCS
求最长相同子序列:#include<cstdio>#include<cstring>#include<queue>#include<algorithm>#include<cmath>#include<stack>#define INF 0x3f3f3f3fusing namespace std;int dp[1005][1005]={0};int main(){ char
2017-08-08 11:31:25
142
原创 Longest Ordered Subsequence --DP
DescriptionA numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence (a1, a2, …, aN) be any sequence (ai1, ai2, …, aiK), where 1 <= i1 < i2 < … < iK <=
2017-08-08 09:53:42
137
原创 Ignatius and the Princess IV --DP
Problem Description“OK, you are not too bad, em… But you can never pass the next test.” feng5166 says. “I will tell you an odd number N, and then N integers. There will be a special integer among them,
2017-08-07 10:52:28
152
原创 Super Jumping! Jumping! Jumping! --DP
Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you n
2017-08-07 10:47:19
146
原创 Reward--topo
Problem Description Dandelion’s uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewards
2017-08-07 08:38:55
195
原创 确定比赛名次--topo
Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M
2017-08-05 17:21:08
269
原创 最短路--dijkstra
n个点,m条边,求1 - n 的距离输入x y z,表示x到y的距离为z 输出1 - n的最短距离 不存在输出-1 #include<cstdio>#include<queue>#include<vector>#include<algorithm>#include<cstring>using namespace std;#define INF 0x3f3f3f3fint dis[10
2017-08-05 10:51:22
140
转载 SPFA--最短路径
给你一个传送门 粗略讲讲SPFA算法的原理,SPFA算法是1994年西安交通大学段凡丁提出是一种求单源最短路的算法算法中需要用到的主要变量int n; //表示n个点,从1到n标号int s,t; //s为源点,t为终点int d[N]; //d[i]表示源点s到点i的最短路int p[N]; //记录路径(或者说记录前驱)queue q; //一个队列,用STL实现,当然可有手打队列
2017-08-04 09:08:02
194
转载 A-B Game --贪心
Fat brother and Maze are playing a kind of special (hentai) game by two integers A and B. First Fat brother write an integer A on a white paper and then Maze start to change this integer. Every time M
2017-08-03 20:52:57
271
原创 Networking --最小生成树
DescriptionYou are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may con
2017-08-03 16:37:22
169
原创 畅通工程--最小生成树(贪心)
Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道
2017-08-03 11:01:35
206
原创 畅通工程--并查集(水)
Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个
2017-08-02 15:15:36
341
1
原创 More is better --并查集
DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements. Mr Wa
2017-08-02 15:11:27
198
原创 树的直径----BFS
树的直径The northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either filled by rock, or free. Ther
2017-08-01 18:22:48
306
原创 走迷宫最短步数--BFS
X:墙;.:可以走的路;D:出口;s:出生点;源程序:#include#include#include#includeusing namespace std;struct node{int x,y;int step;}pr,pl;char map[50][50];int pos[50][50];int h,w;int
2017-08-01 10:49:56
871
原创 Fox And Two Dots --DFS
Fox And Two Dots Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has
2017-07-31 19:14:13
217
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人