- 博客(20)
- 资源 (7)
- 收藏
- 关注
转载 ACM 在有向无环图中求最长路径
http://www.geeksforgeeks.org/find-longest-path-directed-acyclic-graph/给定一个带权有向无环图及源点S,在图中找出从S出发到图中其它所有顶点的最长距离。对于一般的图,求最长路径并不向最短路径那样容易,因为最长路径并没有最优子结构的属性。实际上求最长路径属于NP-Hard问题。然而,对于有向无 环图,最长路径问题有线性时间的解。思路
2017-09-09 16:29:18
3632
原创 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
303
原创 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
578
原创 大一下 关于结构体的知识点
http://c.biancheng.net/cpp/html/88.htmlstruct{ //没有写 stu char *name; //姓名 int num; //学号 int age; //年龄 char group; //所在学习小组 float score; //成绩} stu1, stu2 = { "Tom", 12, 18, 'A
2017-08-29 09:23:32
326
原创 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
339
原创 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
280
原创 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
242
原创 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
330
转载 字符数组的赋值
1、定义的时候直接用字符串赋值 char a[10]=”hello”; //sizeof(a)为10 或char a[]=”hello”; //sizeof(a)为6 注意:不能先定义再给它赋值,如char a[10]; a[10]=”hello”;这样是错误的!2、对数组中字符逐个赋值 char a[10]={‘h’,’e’,’l’,’l’,’o’}; //sizeof(a)为
2017-08-26 15:06:11
319
原创 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
422
原创 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
207
原创 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
372
原创 ACM 1176免费馅饼
一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼,每秒种只有在移动不超过一米的范围内接住坠落的馅饼。现在给这条小径如图标上坐标:为了使问题简化,假设在接下来的一段时间里,馅饼都掉落在0-10这11个位置。开始时gameboy站在5这个位置,因此在第一秒,他只能接到4,5,6这三个位置中其中一个位置上的馅饼。问gameboy最多可能接到多少个馅饼?(假设他的背包可以容纳无穷多个馅饼)I
2017-08-24 17:02:52
1032
原创 大一下期末考试:排序问题
大一下:排序问题/*题目2:数组+冒泡排序=字符串排序*/#include <stdio.h>#include <string.h>void sort(char a[][100],int n);int main(){ char a[100][100]; int i,n; printf("the number:"); scanf("%d",&n); p
2017-08-24 16:21:56
715
原创 大一下期末考试:将数字字符和非数字字符组成的字符串中的数字提取出来
大一下期末考试:将数字字符和非数字字符组成的字符串中的数字提取出来#include <stdio.h>#include <stdlib.h>#include<string.h>#define N 100main(){ char str[N]={'a'}; int i,j; printf("Please input a string:"); scanf("%s
2017-08-24 16:19:45
2664
原创 大一下期末考试:输入一个整形数,按汉语习惯输出,如1052,一千零五十二
大一下:输入一个整形数,按汉语习惯输出,如1052,一千零五十二#include <stdio.h>#include <stdlib.h>#include<math.h>main(){ int n; int a; int i=4,j,k; printf("Please input the number(n<=65535):"); scanf("%
2017-08-24 16:14:56
982
原创 大一下期末考试:统计一行字符串中单词的个数
大一下期末考试:统计一行字符串中单词的个数#include <stdio.h>#include <stdlib.h>#define N 100int main(){ char strings[N]; char i,sum=1; printf("please input a string: "); gets (strings); if(strings[0
2017-08-24 16:13:23
932
网页添加统计图表折线图、扇形图(全,静动态,含4个插件)-gvchart统计图表
2020-03-13
用php实现网页excel导入数据至数据库
2020-03-06
HTML网页设计模板-购物网站(登录、注册、安全设计、个人中心、购物首页、物品展示、意见投诉等等)
2020-03-03
系统集成项目管理工程师(中级).zip
2019-05-30
C#版五子棋.zip
2019-05-30
中缀表达式输入、转换与计算(前缀和后缀)内附流程图
2018-11-17
五子棋小游戏(选择棋盘、棋子;双方计时;显示棋子位置;可键盘输入;判断下子是否合法;保存游戏;继续游戏)
2018-11-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人