自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 赛后总结(2017—ICPC—亚洲区域赛沈阳站)

历经两天的比赛之后,人生第一场亚洲区域赛结束了,这次见识到了和其他学校大牛之间的差距,自己还是太菜了,也从比赛中暴露了一些问题,也学到了很多东西。  热身赛  第一天下午是热身赛,第一次在体育馆中比赛感觉还是有点不一样的(体育馆中还挺暖和的)。比赛在一开始还挺顺利地快速的切出两道水题,但在第三道题是遇到了一个大坑,虽然题目很简单就是一道简单的BFS,但题目要求额外输出一道空行,结果一直wa

2017-10-24 10:15:23 678

原创 Goldbach`s Conjecture

Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:Every even integer, greater than 2, can be expressed as the sum of two primes [1].

2017-09-19 10:52:45 606

转载 比较好的博客

欧拉函数http://blog.csdn.net/sentimental_dog/article/details/52002608逆元:http://www.cnblogs.com/linyujun/p/5194184.html

2017-09-18 21:00:06 397

原创 素数筛

for(long long i = 2; i <= 1010000; i += 2) a[i] = 0; b[1] = 2; for(long long i = 3; i <= 1010000; i += 2) { if(a[i]) { b[t++] = i; for(long

2017-09-18 20:36:44 321

原创 二分图最大匹配

#include using namespace std;int e[101][101];int match[101];int book[101];int n, m;int dfs(int u){ int i; for(i = 1; i <= n; i++) { if(book[i] == 0 && e[u][i] == 1)

2017-08-24 21:05:34 178

原创 矩阵快速幂求斐波那契数列

#include #define mod 1000000007#define ll long longusing namespace std;struct mat{ ll a[2][2];};mat mat_mul(mat x, mat y) //矩阵乘法{ mat res; memset(res.a, 0, sizeof(res.a)); fo

2017-08-24 09:28:58 496

原创 求图的割点

#include using namespace std;int n, m, root, sum;int first[9], next[25], u[25], v[25];int num[9], low[9], flag[9], indexs;void add(int x, int y){ u[sum] = x, v[sum] = y; next[sum] = fi

2017-08-23 19:38:30 360

原创 线段树模板

#include #include #include #define maxn 100005#define mid (l+r)/2using namespace std;int n, m;long long sum[maxn << 2], maxs[maxn << 2], add[maxn<<2];void PushUp(int id){ sum[id] = sum[

2017-08-19 09:26:43 162

转载 组合数取模

#include using namespace std;const long long mod = 1e9+7;const int maxn = 1e5+10;typedef long long LL;LL fac[maxn];LL modxp(LL a,LL b){ LL res = 1; while(b) { if(b&1)

2017-08-16 17:00:50 323

原创 线段树

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。 第二

2017-08-14 20:44:10 391 2

原创 背包dp

Cash MachineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 36579 Accepted: 13263DescriptionA Bank plans to install a machine for cash withdrawal. The mac

2017-08-12 19:30:39 190

原创 FatMouse and Cheese(记忆化搜索)

FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10857    Accepted Submission(s): 4622Problem DescriptionFatMouse

2017-08-11 09:44:59 223

原创 Invitation Cards(两次spfa)

题目大意:给出n个点和n条有向边,求所有点到源点1的来回最短路之和(保证每个点都可以往返源点1)Invitation CardsTime Limit: 8000MS Memory Limit: 262144KTotal Submissions: 28402 Accepted: 9464DescriptionIn t

2017-08-03 09:00:11 254

原创 Wormholes(最短路)

WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 52936 Accepted: 19732DescriptionWhile exploring his many farms, Farmer John has discovered a nu

2017-08-02 14:46:39 191

原创 数据结构实验之图论七:驴友计划(Dijkstra)

数据结构实验之图论七:驴友计划Time Limit: 1000MS Memory Limit: 65536KBProblem Description做为一个资深驴友,小新有一张珍藏的自驾游线路图,图上详细的标注了全国各个城市之间的高速公路距离和公路收费情况,现在请你编写一个程序,找出一条出发地到目的地之间的最短路径,如果有多条路径最短,则输出过路费最少的一条路径。Inp

2017-07-28 09:58:05 499

转载 为何将INF设置为0x3f3f3f3f

转自http://blog.csdn.net/jiange_zh在算法竞赛中,我们常常需要用到一个“无穷大”的值,对于我来说,大多数时间我会根据具体问题取一个99999999之类的数(显得很不专业啊!)在网上看别人代码的时候,经常会看到他们把INF设为0x7fffffff,奇怪为什么设一个这么奇怪的十六进制数,一查才知道,因为这是32-bit int的最大值。如果这个无穷大只用于一般的

2017-07-27 20:47:51 384

原创 C--最短路(Bellman-Ford算法)

C--最短路Time Limit: 7000MS Memory Limit: 65536KBProblem Description给出一个带权无向图,包含n个点,m条边。求出s,e的最短路。保证最短路存在。 Input 多组输入。对于每组数据。第一行输入n,m(1接下来m行,每行三个整数,u,v,w,表示u,v之间有一条权值为w(w >= 0)的边。最后

2017-07-27 20:43:06 549

原创 最短路(Dijkstra算法)

#include using namespace std;int main(){ int maps[10][10], dis[10], book[10], i, j, n, m, t1, t2, t3, u, v, mins; int inf = INT_MAX; scanf("%d %d", &n, &m); for(i = 1; i <= n; i++

2017-07-27 10:39:17 426

原创 Salty Fish

海边躺着一排咸鱼,一些有梦想的咸鱼成功翻身(然而没有什么卵用),一些则是继续当咸鱼。一个善良的渔夫想要帮这些咸鱼翻身,但是渔夫比较懒,所以只会从某只咸鱼开始,往一个方向,一只只咸鱼翻过去,翻转若干只后就转身离去,深藏功与名。更准确地说,渔夫会选择一个区间[L,R],改变区间内所有咸鱼的状态,至少翻转一只咸鱼。渔夫离开后想知道如果他采取最优策略,最多有多少只咸鱼成功翻身,但是咸鱼大概有十万条,所

2017-07-24 20:16:39 464

原创 单调栈(山峰)

Problem Description金石山脉有n个山峰,一字排开,从西向东依次编号为1, 2, 3, ……, n。编号为i的山峰高度为hi。每个山峰的高度两两不同小木示从西向东依次爬过这n个山峰,到每一个山峰的山顶的时候,他都会往西边眺望,并且会记录下自己能看到的山峰的个数。(比如说小木示 现在在4号山峰,前四号山峰的高度分别为9,4,5,1。他现在能看到的山峰个数就是2,因为第

2017-07-24 20:04:57 728

原创 Satisfactory Pairs

Given a positive integer, , find and print the number of pairs of positive integers, where , that exist such that the equation  (where  and are positive integers) has at least one solution.

2017-06-25 11:19:22 256

原创 并查集( Roads and Libraries locked)

The Ruler of HackerLand believes that every citizen of the country should have access to a library. Unfortunately, HackerLand was hit by a tornado that destroyed all of its libraries and obstructed it

2017-06-20 21:06:41 326

转载 并查集详解 (转)

这个文章是几年前水acm的时候转的, 当时也不知道作者是谁, 要是有人知道的话说一下吧并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?)来看一个实例,杭电1232畅通工程首先在地图上给你若干个城镇,这些城镇都可以看作点,然后告

2017-06-20 21:02:32 240

原创 校赛~校赛~

Problem DescriptionSDUT 的校赛是从 2009 年开始的,康纳每年看到比赛之后,往往就会喊一声 “ma ji ya ba ku nai + 年份的缩写”。比如说 2009 年就会说 “ma ji ya ba ku nai 9”。年份的缩写是一个字符串形式的,但是如果当前选择的字符串以前已经被用过,就会再向前继续取,比如说 2019 年的话康纳一开始会选择 9 但是 9

2017-06-05 16:59:50 662

转载 快速幂

快速计算a^b防止超时#include using namespace std;long long powmod(int a, int b);int main(){ int a, b; cin >> a >> b; cout << powmod(a, b) << endl; return 0;}long long powmod(int a, int

2017-06-03 20:03:53 207

原创 已知一棵二叉树的中序遍历和后序遍历,求二叉树的先序遍历

#include #include #include struct node{ int data; struct node *lchild,*rchild;};struct node *creat(int n,char *a,char *b){ struct node *root; char *p; if(n == 0) ret

2017-02-22 21:03:21 1319

原创 二叉树:根据二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列

#include #include #include struct node{ int data; struct node *lchild,*rchild;};struct node *creat(int n,char *a,char *b){ struct node *root; char *p; if(n==0) retur

2017-02-22 20:13:17 1969

原创 二叉树先序遍历,中序遍历,后序遍历

二叉树问题,根据先序序列输入字符,然后输出其先序遍历,中序遍历,后序遍历。#include #include #include typedef struct tree{ char data; struct tree *left, *right; //二叉树左孩子,右孩子}tree; //定义二叉树

2017-02-21 19:16:37 387

原创 kmp算法

自己写的kmp算法,帮助自己理解。关键是next算法。原题网址 : http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Contest/contestproblem/cid/2002/pid/2772#include #include #include char a[1000050], b[1000050];int next

2017-02-20 19:53:49 319

空空如也

空空如也

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

TA关注的人

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