![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
洛水成诗
这个作者很懒,什么都没留下…
展开
-
ACM 1176免费馅饼
一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼,每秒种只有在移动不超过一米的范围内接住坠落的馅饼。现在给这条小径如图标上坐标:为了使问题简化,假设在接下来的一段时间里,馅饼都掉落在0-10这11个位置。开始时gameboy站在5这个位置,因此在第一秒,他只能接到4,5,6这三个位置中其中一个位置上的馅饼。问gameboy最多可能接到多少个馅饼?(假设他的背包可以容纳无穷多个馅饼)I原创 2017-08-24 17:02:52 · 995 阅读 · 1 评论 -
ACM 在有向无环图中求最长路径
http://www.geeksforgeeks.org/find-longest-path-directed-acyclic-graph/给定一个带权有向无环图及源点S,在图中找出从S出发到图中其它所有顶点的最长距离。对于一般的图,求最长路径并不向最短路径那样容易,因为最长路径并没有最优子结构的属性。实际上求最长路径属于NP-Hard问题。然而,对于有向无 环图,最长路径问题有线性时间的解。思路转载 2017-09-09 16:29:18 · 3550 阅读 · 0 评论 -
ACM Nim游戏(组合博弈论)
对于nim游戏的某个位置(x1,x2,x3),当且仅当它各部分的nim-sum等于0时(即x1⊕x2⊕x3=0),则当前位于必败点。#include <stdio.h>#include <string.h>int m[101];int main(){ int i,sum,n,num; while(1) { scanf("%d",&n);原创 2017-08-30 15:27:46 · 532 阅读 · 0 评论 -
ACM 1392 Surround the Trees
http://www.cnblogs.com/jbelial/archive/2011/08/05/2128624.html 典型的凸包问题#include<stdio.h>#include<stdlib.h>#include<math.h>typedef struct { double x , y ;}POINT ;POINT result[110] ;// 模拟堆栈原创 2017-08-27 13:17:34 · 215 阅读 · 0 评论 -
ACM 母函数问题模板
#include <iostream>using namespace std;const int lmax=10000;int c1[lmax+1],c2[lmax+1];// c1是保存各项质量砝码可以组合的数目 // c2是中间量,保存每一次的情况int main(){ int n,i,j,k; while (cin>>n) { for (i原创 2017-08-28 10:52:06 · 313 阅读 · 0 评论 -
ACM 1398 Square Coins
母函数问题//HDOJ_1398 Square Coins#include <iostream>using namespace std;const int lmax=300;int c1[lmax+1],c2[lmax+1];int main(void){ int n,i,j,k; while (cin>>n && n!=0) { for (i=原创 2017-08-28 10:01:53 · 262 阅读 · 0 评论 -
ACM 1087 Super Jumping! Jumping! Jumping!
#include"stdio.h"int main(){ int a[1101],b[1101],n,i,j,sum; while(scanf("%d",&n)!=EOF&&n) { for(i=0;i<n;i++) scanf("%d",&a[i]); sum=0; b[0]=a[0];原创 2017-08-24 17:09:33 · 343 阅读 · 0 评论 -
ACM 1021 Fibonacci Again
Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). Print the word “yes” if 3 divide evenly into F(n). Print the word “no” if not.#include<stdio.h>int main(){ int n; whil原创 2017-08-27 13:09:03 · 300 阅读 · 0 评论 -
ACM:凸包问题
#include <stdio.h>#include <math.h>#include <stdlib.h>typedef struct{ double x; double y;}POINT;POINT result[102]; //保存凸包上的点POINT a[102];原创 2017-08-25 09:57:36 · 379 阅读 · 0 评论 -
ACM 1003 Max Sum
Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.#include <stdio.h>原创 2017-08-24 17:13:40 · 184 阅读 · 0 评论 -
ACM 2037 今年暑假不AC
贪心算法 //贪心思想:节目时间越早结束,能看的节目数量就越多# include <stdio.h># include <string.h> # include <malloc.h> struct program//定义一个结构体 保存节目的开始和结束时间; { int start=0; int end=0;};typedef struct program strp;//原创 2017-09-02 09:45:41 · 278 阅读 · 0 评论