
ACM-ICPC
文章平均质量分 60
neng18
这家伙很懒,什么都没有留下。
展开
-
poj 1065 Wooden Sticks_贪心
简单贪心原创 2014-03-05 23:08:24 · 701 阅读 · 0 评论 -
hdu 1241 Oil Deposits_dfs or bfs
dfs最经典的例题原创 2014-02-27 14:47:30 · 777 阅读 · 0 评论 -
hdu 1166 敌兵布阵_线段树
题意:略思路:这题是单点更新,如果是减少的话,直接把数据变成负加上去就行了。#include #include#includeusing namespace std;#define MAXN 50010int n,ans;struct{ int l,r,value;}tree[MAXN<<2];void Build(int l,int r,int id){原创 2014-02-21 17:28:22 · 734 阅读 · 0 评论 -
ACM计算几何题目推荐
很好的几何题转载 2014-01-23 11:51:20 · 1187 阅读 · 0 评论 -
计算几何之凸包_卷包裹算法
====================================================================一.凸集&凸包(下文中所有的集合 若不作特殊说明 都是指欧氏空间上的集合)凸集(Convex Set):任意两点的连线都在这个集合内的集合就是一个凸集.A set in Euclidean space is convex set if it co转载 2013-11-20 21:11:21 · 1038 阅读 · 0 评论 -
poj 2975 Nim_最经典的Nim取石子
题意:给你n堆石头,每次只能在一堆取最少一个石子,最后拿走最后一堆的为胜者,问胜者有多少种赢得取法#include #includeusing namespace std;int main(int argc, char** argv) { int n,stone[1010],i,t; while(scanf("%d",&n)!=EOF,n){ t=0; for(i原创 2013-10-26 23:18:26 · 555 阅读 · 0 评论 -
poj 1273 Drainage Ditches_最大流模版
#include #include#include#includeusing namespace std; #define INF 0xfffffff #define N 210 int cap[N][N],flow[N][N]; int pre[N],dist[N]; int ek(int sta,int end){ int i,curr,sum=0; memset(f原创 2013-09-24 22:56:04 · 494 阅读 · 0 评论 -
poj 3070 Fibonacci
#include#includeusing namespace std;struct node{ int v[2][2];};node mult(node ma,node mb){ int i,j,k; node ans; for(i=0;i<2;i++) for(j=0;j<2;j++) { ans.v[i][j]=0; for(k=0;k<2;k++)原创 2013-07-05 20:15:08 · 560 阅读 · 0 评论 -
soj 1033 City Road_经典dp
很经典的动态规划啊原创 2014-05-02 22:24:20 · 876 阅读 · 0 评论 -
soj 1034 Forest_求树的深度和宽度
求树的深度和宽度原创 2014-05-02 20:00:31 · 1162 阅读 · 0 评论 -
poj 1852 Ants_贪心
非常有趣的一道题目,真是脑筋急转弯原创 2014-02-27 16:44:32 · 762 阅读 · 0 评论 -
hdu 2896 病毒侵袭_ac自动机
ac自动机算法原创 2014-03-28 21:30:41 · 662 阅读 · 0 评论 -
uva 10382 Watering Grass_贪心
挺好玩的一道几何加贪心的题目原创 2014-02-28 22:54:45 · 885 阅读 · 0 评论 -
判图的连通性(dfs,并查集)
判断图的连通性两种方法原创 2014-01-22 18:03:53 · 1525 阅读 · 0 评论 -
poj 1664 放苹果_整数拆分
题意:略用手机敲的代码真是泪流满面,终于过了#includeusing namespace std;int dp[110][110];void solve(){ int i,j; memset(dp,0,sizeof(dp)); for(i=1;i<=15;i++) for(j=1;j<=15;j++){ if(i==1||原创 2013-12-02 19:30:15 · 564 阅读 · 0 评论 -
POJ 动态规划题目列表
]POJ 动态规划题目列表容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平 衡), 1936转载 2013-11-26 21:07:34 · 700 阅读 · 0 评论 -
hdu 2222 Keywords_ac自动机模板
题意:给你n个单词,再给你一串字符,求在字符中有多少个单词出现过 #include #include#includeusing namespace std;#define N 10010#define MAXLEN 1000010struct node{ node *child[26]; node *fail; int count; void ini原创 2013-08-19 00:07:53 · 457 阅读 · 0 评论 -
DevC++ 工程没有调试信息的解决办法
DevC++4.9.9.2中,按 F8 开始调试。提示信息为:工程没有调试信息,您想打开工程的调试选项并重新生成吗?选择是后,再按F8,仍旧是这个信息。什么原因呢?按照帮助,Frequently Asked Questions (FAQ)中提示How do i enable Debugging mode ?Go to Compiler Options and click on转载 2013-07-20 16:16:12 · 3631 阅读 · 0 评论 -
hdu 1078 FatMouse and Cheese_记忆搜索
做这类型的搜索比较少,看懂题意花了半天题意:给你个n*n的图,老鼠一次最远走k步,老鼠起初在(0,0),每次偷吃的东西必须比之前偷吃的总和都要大。#include#includeusing namespace std;#define N 110int map[N][N],dp[N][N];int n,k;int dir[][2]={{1,0},{0,1},{-1,0原创 2013-07-06 21:04:47 · 569 阅读 · 0 评论 -
hdu 2066 一个人的旅行_最短路
超级经典的最短路原创 2014-05-07 23:01:28 · 727 阅读 · 0 评论 -
最大独立集问题
最大独立集问题Given N sets of integers, remove some sets so that the remaining all sets are disjoint with one another. Find the optimal solution so that the number of sets remaining at the end is maxim转载 2014-05-03 20:22:19 · 2706 阅读 · 0 评论 -
HDU 1043 八数码问题 A*搜索
转载请注明出处,谢谢 http://blog.youkuaiyun.com/ACM_cxlove?viewmode=contents by---cxlove第一个A*搜索,A*是一种启发式搜索,g为已花代价,h为估计的剩余代价,而A*是根据f=g+h作为估价函数进行排列,也就是优先选择可能最优的节点进行扩展。对于八数码问题,以下几个问题需要知道判断有无解问题:根转载 2014-04-29 23:17:29 · 453 阅读 · 0 评论 -
hdu 1423 Greatest Common Increasing Subsequence_LCIS
求两串的最长公共上升子序列原创 2014-04-20 15:39:41 · 684 阅读 · 0 评论 -
poj 1149 PIGS_网络流
#include#include#include#includeusing namespace std;#define INF 0xfffffff#define mMax 1010#define nMax 110int cap[nMax][nMax],flow[nMax][nMax];int pre[nMax],dist[nMax];int Edmonds_Karp(int s原创 2013-09-23 22:58:52 · 498 阅读 · 0 评论 -
hdu 1050 Moving Tables_贪心
有趣的贪心题原创 2014-03-06 13:02:16 · 793 阅读 · 0 评论 -
poj 3287 The Trip, 2007_贪心
简单的贪心题原创 2014-03-01 17:25:58 · 1220 阅读 · 0 评论 -
uva 10026 Shoemaker's Problem _贪心
贪心原创 2014-02-27 15:49:55 · 798 阅读 · 0 评论 -
hdu 1698 Just a Hook_线段树
线段树原创 2014-01-25 17:44:31 · 848 阅读 · 0 评论 -
hdu 1690 The Balance_母函数
母函数原创 2014-01-24 21:29:41 · 757 阅读 · 0 评论 -
hdu 2665 Kth number_划分树
划分树原创 2014-01-23 20:39:35 · 888 阅读 · 0 评论 -
poj 1088 滑雪_记忆化搜索
题意:略直接用记忆搜索就行了#include#includeusing namespace std;int n,m;int map[105][105];int len[105][105]={0};int dp(int x,int y){ int max,temp; if(len[x][y]) return len[x][y]; max=0; if(x+1map[x原创 2013-11-27 20:02:49 · 450 阅读 · 0 评论 -
Nim游戏博弈
Nim游戏的概述:还记得这个游戏吗?给出n列珍珠,两人轮流取珍珠,每次在某一列中取至少1颗珍珠,但不能在两列中取。最后拿光珍珠的人输。后来,在一份资料上看到,这种游戏称为“拈(Nim)”。据说,它源自中国,经由被贩卖到美洲的奴工们外传。辛苦的工人们,在工作闲暇之余,用石头玩游戏以排遣寂寞。后来流传到高级人士,则用便士(Pennies),在酒吧柜台上玩。最有名的玩法,是把十二枚便士放转载 2013-10-26 23:13:05 · 682 阅读 · 0 评论 -
poj 2425 A Chess Game_sg函数
题意:给你一个有向无环图,再给你图上的棋子,每人每次只能移动一个棋子,当轮到你不能移动棋子是就输了,棋子可以同时在一个点比赛是就差这题没ak,做了几天博弈终于搞懂了.#include #include #include#includeusing namespace std;#define N 1010vector adj[N]; int sg[N],n;int mex(原创 2013-10-30 21:23:36 · 550 阅读 · 0 评论 -
hdu 2157 How many ways_ 矩阵快速幂
题意:略直接矩阵乘法就行了#include #include#includeusing namespace std;#define LL __int64#define N 30int n,m;struct node{ int mat[N][N]; node operator *(const node &x){ node tmp;原创 2013-11-13 22:29:30 · 641 阅读 · 0 评论 -
hdu 1502 Regular Words_高精度+dp
java高精度+dp原创 2014-03-15 23:28:53 · 734 阅读 · 0 评论 -
hdu 1715 大菲波数_java
用java的大数解决import java.math.BigInteger;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); BigInteger f[]=new BigIn原创 2014-01-22 19:01:35 · 527 阅读 · 0 评论 -
poj 1018 Communication System_贪心
题意:给你n个厂,每个厂有m个产品,产品有B(带宽),P(价格),现在要你求最大的 B/P明显是枚举,当P大于一定值,B/P为零,可以用这个剪枝#include #include#includeusing namespace std;#define N 110#define INF 0xffffffint devb[N][N],devp[N][N];int b[N*100],原创 2013-11-26 18:47:51 · 544 阅读 · 0 评论 -
poj 2704 Pascal's Travels_记忆化搜索
一道简单但是题意蛋疼的题目题意:给你个n*n的图,开始在左上角,要求走到右下角有多种走法,图上的数表示走几步,只能向右或向下走。 #include#includeusing namespace std;#define N 40char map[N][N];int n;__int64 dp[N][N];__int64 solve(int x,int y){原创 2013-07-07 16:52:01 · 518 阅读 · 0 评论 -
poj 1080 Human Gene Functions_简单dp
简单dp原创 2014-05-04 22:01:18 · 605 阅读 · 0 评论 -
hdu 3068 最长回文_Manacher模板
Manacher算法应用原创 2014-04-21 19:51:36 · 781 阅读 · 0 评论