02 2011 档案

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1106代码:#include<stdio.h>#include<string.h>#include<stdlib.h>int cmp(const void *a,const void *b){ return *(int *)a-*(int *)b;}int main(){ char s[1001]; int len,i,sum,cnt; while(scanf("%s",s)!=EOF){ getchar(); len=strlen(s); ... 阅读全文

posted @ 2011-02-28 22:02 江南烟雨hust 阅读(289) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=2021代码:#include<stdio.h>#include<stdlib.h>int r[6]={100,50,10,5,2,1};int main(){ int n,i,j,temp; while(scanf("%d",&n)!=EOF){ if(n==0)break; int num[6]={0},cnt=0; for(i=0;i<n;i++){ scanf("%d",&temp); ... 阅读全文

posted @ 2011-02-28 15:34 江南烟雨hust 阅读(232) 评论(0) 推荐(0)

摘要:【1】不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。貌似比较简单,这是我写的代码,也不知道是否正确。仅供参考!代码:#include<stdio.h>#include<stdlib.h>int main(){ char s1[200],s2[100]; int i,len1,len2; scanf("%s %s",s1,s2); for(i=0;i<200;i++){ if(s1[i]=='/0'){ len1=i; break; } ... 阅读全文

posted @ 2011-02-27 20:37 江南烟雨hust 阅读(284) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=2017这道题居然提交了几次才AC,原因是对gets()的用法不太熟悉。AC代码:#include<stdio.h>#include<string.h>#include<stdlib.h>char s[100000];int main(){ int n,len,i,count; scanf("%d",&n); getchar(); while(n--){ count=0; gets(s); len=strlen(s); ... 阅读全文

posted @ 2011-02-27 16:05 江南烟雨hust 阅读(383) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=2015代码:#include<stdio.h>#include<stdlib.h>int main(){ int n,m,i,j,sum,flag,a[100],cnt; while(scanf("%d %d",&n,&m)!=EOF){ j=0; sum=0; flag=0; cnt=0; for(i=1;i<=n;i++){ j+=2; sum+=j; ... 阅读全文

posted @ 2011-02-27 14:11 江南烟雨hust 阅读(157) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=2015代码:#include<stdio.h>#include<stdlib.h>int main(){ int n,m,i,j,sum,flag,a[100],cnt; while(scanf("%d %d",&n,&m)!=EOF){ j=0; sum=0; flag=0; cnt=0; for(i=1;i<=n;i++){ j+=2; sum+=j; ... 阅读全文

posted @ 2011-02-27 14:11 江南烟雨hust 阅读(338) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=3783代码:#include<stdio.h>#include<string.h>#include<stdlib.h>int main(){ char s[101]; while(gets(s)!=NULL){ if(strcmp(s,"E")==0)break; int cnt1=0,cnt2=0,cnt3=0; int i,len; len=strlen(s); //printf(); for... 阅读全文

posted @ 2011-02-26 20:44 江南烟雨hust 阅读(162) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=3783代码:#include<stdio.h>#include<string.h>#include<stdlib.h>int main(){ char s[101]; while(gets(s)!=NULL){ if(strcmp(s,"E")==0)break; int cnt1=0,cnt2=0,cnt3=0; int i,len; len=strlen(s); //printf(); for... 阅读全文

posted @ 2011-02-26 20:44 江南烟雨hust 阅读(125) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1881代码:#include<stdio.h>#include<stdlib.h>struct node{//每场bg的信息数据结构定义; int h,l,t;//快乐度,持续时间、离开时间; }H[31];int cmp(const void *a,const void *b){//qsort函数的比较函数; return (*(node *)a).t-(*(node *)b).t;//升序排列; }int main(){ int N; while(scanf("%d 阅读全文

posted @ 2011-02-26 20:16 江南烟雨hust 阅读(184) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1881代码:#include<stdio.h>#include<stdlib.h>struct node{//每场bg的信息数据结构定义; int h,l,t;//快乐度,持续时间、离开时间; }H[31];int cmp(const void *a,const void *b){//qsort函数的比较函数; return (*(node *)a).t-(*(node *)b).t;//升序排列; }int main(){ int N; while(scanf("%d 阅读全文

posted @ 2011-02-26 20:16 江南烟雨hust 阅读(182) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1880AC代码:#include<stdio.h>#include<string.h>#include<stdlib.h>char s[100001][110],a[100001][25],b[100001][90];//放在主函数里面就是堆栈溢出!!!!!!!! int main(){ int i=0,j,k,len,count,N; while(gets(s[i])!=NULL){ if(strcmp(s[i],"@END@")==0)brea 阅读全文

posted @ 2011-02-26 18:25 江南烟雨hust 阅读(214) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1880AC代码:#include<stdio.h>#include<string.h>#include<stdlib.h>char s[100001][110],a[100001][25],b[100001][90];//放在主函数里面就是堆栈溢出!!!!!!!! int main(){ int i=0,j,k,len,count,N; while(gets(s[i])!=NULL){ if(strcmp(s[i],"@END@")==0)brea 阅读全文

posted @ 2011-02-26 18:25 江南烟雨hust 阅读(124) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1877代码:#include<stdio.h>#include<stdlib.h>int main(){ int m,A,B; while(scanf("%d",&m)!=EOF){ if(m==0)break; scanf("%d %d",&A,&B); int res=A+B; int r[50],count=0,i; while(res/m>0){ r[count++]=res%... 阅读全文

posted @ 2011-02-26 16:13 江南烟雨hust 阅读(143) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1877代码:#include<stdio.h>#include<stdlib.h>int main(){ int m,A,B; while(scanf("%d",&m)!=EOF){ if(m==0)break; scanf("%d %d",&A,&B); int res=A+B; int r[50],count=0,i; while(res/m>0){ r[count++]=res%... 阅读全文

posted @ 2011-02-26 16:13 江南烟雨hust 阅读(130) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1873代码:#include<stdio.h>#include<string.h>#include<stdlib.h>struct patient{//病人信息数据结构定义; int id;//病人编号; int prior;//病人优先级; }p[3][2001];//3个队列,对应3个医生; int main(){ int N; while(scanf("%d",&N)!=EOF){ int i,j,cnt=0;//记录病人编号; .. 阅读全文

posted @ 2011-02-26 15:44 江南烟雨hust 阅读(189) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1873代码:#include<stdio.h>#include<string.h>#include<stdlib.h>struct patient{//病人信息数据结构定义; int id;//病人编号; int prior;//病人优先级; }p[3][2001];//3个队列,对应3个医生; int main(){ int N; while(scanf("%d",&N)!=EOF){ int i,j,cnt=0;//记录病人编号; .. 阅读全文

posted @ 2011-02-26 15:44 江南烟雨hust 阅读(159) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1872代码:#include<stdio.h>#include<string.h>#include<stdlib.h>int main(){ int N; while(scanf("%d",&N)!=EOF){ char a[400][60],b[400][60]; int c[400],d[400],i,j,temp; int id[400];//记录按学生成绩稳定排序后的数据组号; for(i=0;i<N;i++){ ... 阅读全文

posted @ 2011-02-26 14:47 江南烟雨hust 阅读(114) 评论(0) 推荐(0)

摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1872代码:#include<stdio.h>#include<string.h>#include<stdlib.h>int main(){ int N; while(scanf("%d",&N)!=EOF){ char a[400][60],b[400][60]; int c[400],d[400],i,j,temp; int id[400];//记录按学生成绩稳定排序后的数据组号; for(i=0;i<N;i++){ ... 阅读全文

posted @ 2011-02-26 14:47 江南烟雨hust 阅读(134) 评论(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 阅读(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 阅读(128) 评论(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 阅读(158) 评论(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 阅读(213) 评论(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 阅读(183) 评论(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 阅读(134) 评论(0) 推荐(0)

导航