2011年2月25日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1871代码:#include<stdio.h>#include<stdlib.h>struct hotel{//宾馆信息数据结构; int id;//宾馆编号; int num;//宾馆房间数; int price;//宾馆价格; }h[101];int cmp(const void *a,const void *b){//比较函数; return (*(hotel *)a).price-(*(hotel *)b).price;}int main(){ ... 阅读全文
posted @ 2011-02-25 22:00 江南烟雨hust 阅读(158) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1871代码:#include<stdio.h>#include<stdlib.h>struct hotel{//宾馆信息数据结构; int id;//宾馆编号; int num;//宾馆房间数; int price;//宾馆价格; }h[101];int cmp(const void *a,const void *b){//比较函数; return (*(hotel *)a).price-(*(hotel *)b).price;}int main(){ ... 阅读全文
posted @ 2011-02-25 22:00 江南烟雨hust 阅读(124) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1862代码:#include<stdio.h>#include<string.h>#include<stdlib.h>struct record{//学生记录数据结构定义; char id[7]; char name[10]; int score;}rec[100001];int cmp1(const void* a,const void* b){//按学号递增排序的比较函数; return strcmp((*(record *)a).id,(*(recor... 阅读全文
posted @ 2011-02-25 18:34 江南烟雨hust 阅读(155) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1862代码:#include<stdio.h>#include<string.h>#include<stdlib.h>struct record{//学生记录数据结构定义; char id[7]; char name[10]; int score;}rec[100001];int cmp1(const void* a,const void* b){//按学号递增排序的比较函数; return strcmp((*(record *)a).id,(*(recor... 阅读全文
posted @ 2011-02-25 18:34 江南烟雨hust 阅读(212) 评论(0) 推荐(0)
摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1231代码:#include<stdio.h>#include<stdlib.h>#define MAX 10001//动态规划:状态方程:c[n]=max{c[n-1]+a[n],a[n]}; int main(){ int K; while(scanf("%d",&K)!=EOF){ if(K==0)break; int a[MAX],i; for(i=0;i<K;i++){ scanf("%d",&a[i]) 阅读全文
posted @ 2011-02-25 18:30 江南烟雨hust 阅读(182) 评论(0) 推荐(0)
摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1231代码:#include<stdio.h>#include<stdlib.h>#define MAX 10001//动态规划:状态方程:c[n]=max{c[n-1]+a[n],a[n]}; int main(){ int K; while(scanf("%d",&K)!=EOF){ if(K==0)break; int a[MAX],i; for(i=0;i<K;i++){ scanf("%d",&a[i]) 阅读全文
posted @ 2011-02-25 18:30 江南烟雨hust 阅读(115) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1861代码:#include<stdio.h>#include<stdlib.h>struct info{//记录的数据结构; int id;//船号; char key;//键值; int time;//时间(分钟表示); }tur[10000];int main(){ int i=0,j=0,count=0,time=0; //count记录租船次数,time记录总时间; while(scanf("%d",&tur[i].id)!=EOF& 阅读全文
posted @ 2011-02-25 12:59 江南烟雨hust 阅读(146) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1861代码:#include<stdio.h>#include<stdlib.h>struct info{//记录的数据结构; int id;//船号; char key;//键值; int time;//时间(分钟表示); }tur[10000];int main(){ int i=0,j=0,count=0,time=0; //count记录租船次数,time记录总时间; while(scanf("%d",&tur[i].id)!=EOF& 阅读全文
posted @ 2011-02-25 12:59 江南烟雨hust 阅读(132) 评论(0) 推荐(0)

导航