自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Light OJ 1094 + Farthest Nodes in a Tree(搜索)

大致题意:给出一个n个节点的无环连通图, 每条边都有权值,求最长的两个点之间的距离。#include #include #include #include #include using namespace std;const int M = 30010;struct edge{ int to; int val; edge(){} edge(int pp, int qq):

2015-03-27 09:35:30 392

原创 Milking Time(3616) 简单dp

大致题意:给N头牛的产奶时间和产南

2014-11-10 16:39:27 345

转载 Cow Exhibition(2184)

大致题意:给num头牛的S和F值(-1000 <= S,F <= )

2014-11-09 22:51:36 278

原创 Radar Installation(1328)

大致题意:给定一些点和固定半径的圆, yuanx

2014-11-06 15:05:26 313

原创 Ant Counting(3046)

大致题意:给n. m. l, y,n 种数,m个数, 问cpn

2014-11-05 13:27:50 289

原创 Moo University - Financial Aid(2010)

大致题意:n, m, f,从m个组中选出n组,要求这n组的

2014-10-30 20:07:03 598

原创 Wireless Network(2236)

大致题意:有n个电脑坏了,现在只能一个一个的修,xianz

2014-10-27 20:24:15 414

原创 Yogurt factory(2393)

总觉得贪心的时候总是有什么想不清楚

2014-10-27 16:01:11 350

原创 B. Friends and Presents

http://codeforces.com/contest/483/problem/B

2014-10-26 11:26:47 451

原创 GCD & LCM Inverse

http://poj.org/problem?id=2429大致题意:

2014-10-23 14:25:45 430

原创 C. Table Decorations

http://codeforces.com/contest/478/problem/Cg

2014-10-21 23:22:48 372

原创 Apple Catching(2385)

http://poj.org/problem?id=2385da

2014-10-21 16:20:54 307

转载 Protecting the Flowers(3262)

题解:考虑当前选哪个放在开头。设放在开头的为(d1,t1) 放在第二个的为(d2,t2)。那么放在开头的牛满足:无论第二个是什么,交换第一和第二总是不会变优。设当前剩余牛的d值和为ds。那么有:(ds-d1)*t1+(ds-d1-d2)*t2化简得: t2/d2>t1/d1。也就是说,当t[i]/d[i]>t[j]/t[j]时,j放在i前面更优。若开头的是t

2014-10-21 14:46:31 344

原创 Long Jumps

http://codeforces.com/contest/479/problem/D题目

2014-10-21 11:19:23 592

原创 Meteor Shower(3669)

大致题意:有一些炸弹会在

2014-10-20 15:48:29 367

原创 Stall Reservations(3190)

大致题意:有一些奶牛只能在指定的时间内挤牛奶,而一个机器只能同时对一个奶牛工作。给你每头奶牛的指定时间的区间,问你最小需要多少机器

2014-10-20 15:45:00 346

原创 二分查找

#include #include #include #include using namespace std;int a[100];//在数组里找到第一个大于pp的数int search(int l, int r, int pp){ int res = -1; while(l <= r){ int mid = (l+r) / 2; i

2014-10-17 11:54:30 312

原创 用dfs的方法判断图中有没有负环

//原理:用一个点去更新和他相连的一条边,然后在用相连的点去更新和当前的点相连的边,一次下去, 当连到之前更新过的点的时候, 就说明有负环。dfs的深度是不会超过//当前这棵生成树的点数+2.

2014-10-17 10:59:25 1137

原创 最小生成树kruskal算法

#include #include #include #include using namespace std;int par[100], n, m;struct edge{ int x, y; int val;}pp[10000];bool cmp(edge a, edge b){ return a.val < b.val;}int find(int

2014-10-14 10:42:05 281

原创 最小生成树的prim算法

#include #include #include #include #define inf 999999using namespace std;int d[100], n, dis[100][100];bool deleted[100], vis[100];int main(){ int i, j; while(scanf("%d", &n)!=EOF){

2014-10-14 09:52:41 289

原创 最短路路径还原

#include #include #include #include #define inf 100000using namespace std;int n, m, d[100], pre[100], dis[100][100];bool vis[100];int main(){ int i, j; while(scanf("%d%d", &n, &m) == 2

2014-10-13 23:42:05 363

原创 优先队列解决最短路问题

用优先队列解决最短路问题,会将复杂度降低

2014-10-13 22:19:40 550

原创 codeforces364A--- Matrix

点击打开链接题目大意:

2014-09-23 18:47:44 313

原创 优先队列解决广搜的问题

点击打开链接题目大意:

2014-09-22 19:50:17 546

原创 hdu 5001 矩阵 快速幂

题目大意:给n个点,m条边,每个点

2014-09-16 14:50:22 289

原创 Magic Formulas

点击打开链接题意:给出一个式子,求出它的值,用的是异或运算。方法:因为异或运算是可以交换的,所以可以将Q的表达式改成p1^p2^...^pn^(1 mod 1)^(2 mod 1)^...^(1 mod 2)^(2 mod 2).....            可以发现模2 的余数的特点是1,0,1,0.。。。模3 的余数的特点是1,2,0,1,2,0.。。。所以可以用d[i]=1

2014-04-25 19:42:07 411

原创 C - Addition Chains

http://poj.org/problem?id=2248题意:给出一个数,

2014-04-21 20:44:06 382

原创 B - ZZY’s Dilemma

http://acm.hdu.edu.cn/showproblem.php?pid=4152题意:

2014-04-21 20:30:38 405

原创 A - Lotto

做ACM有一段时间了,可是一直都没什么cheng

2014-04-21 20:12:37 459

原创 Fox and Box Accumulation

while中的每一个for循环都是一摞箱子,用num表示当前是这一摞的第几个,只有a[i]>=num时,才能往下放。

2014-02-08 21:34:51 475

原创 cs

#include bool vis[100005];int prime[100005], tot;void init(int n) { int i, j; for(i = 2; i*i <= n; i++) if(!vis[i]) for(j = i*i; j <= n; j += i) vis[j] = 1; for(i = 2; i <= n; i++) if(!v

2013-12-03 21:43:03 414

空空如也

空空如也

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

TA关注的人

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