
Online Judge练习题
leizh007
这个作者很懒,什么都没留下…
展开
-
杭电HDU1874-畅通工程续
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1874C语言源码:#include#include#define maxsize 300int E[maxsize][maxsize];int visited[maxsize];int length[maxsize];int main(){ int n,m,i,j,min,fmi原创 2013-03-03 18:50:45 · 207 阅读 · 0 评论 -
杭电HDU1875-畅通工程再续
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1875C语言源码:#include#include#include#define maxsize 10000typedef struct edge{ int a,b; double length;}edge;edge E[maxsize];int cmp(const void原创 2013-03-03 19:35:38 · 185 阅读 · 0 评论 -
杭电HDU3794-Magic Coupon
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3794C语言源码:#include#include#define maxsize 1000010int cmp1(const void *a,const void *b){ return *(int *)b-*(int *)a;}int cmp2(const void *a,con原创 2013-03-08 10:17:31 · 270 阅读 · 0 评论 -
九度1488-百万富翁问题
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1488C语言源码:#include#includeint main(){ printf("%d %d\n",10*30,(int)pow(2,30)-1);}原创 2013-03-08 11:02:09 · 322 阅读 · 0 评论 -
杭电HDU3792-Twin Prime Conjecture
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3792C语言源码:#include#define maxsize 100000int T[maxsize];int S[maxsize];void pri(){ long long i,j,num; for(i=2;i<maxsize;i++) { if(T[i]==0)原创 2013-03-08 09:26:35 · 295 阅读 · 0 评论 -
杭电HDU3793-Is It Symmetric
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3793C语言源码:#include#includeint sym(char s[],int n,int start,int end){ int i,j; i=start; j=end; while(i!=j) { if(s[i]!=s[j]) return -1;原创 2013-03-08 09:44:25 · 270 阅读 · 0 评论 -
九度1490-字符串链接
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1490C语言源码:#includeint main(){ char s1[1000],s2[1000]; int i; while(scanf("%s %s",s1,s2)!=EOF) { printf("%s%s\n",s1,s2); }}原创 2013-03-08 11:12:40 · 222 阅读 · 0 评论 -
九度1485-W's Cipher
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1485提供组测试数据:3 0 0abC语言源码:#include#define maxsize 10000char S[maxsize];int s1[maxsize],s2[maxsize],s3[maxsize],top1,top2,top3;void change(int原创 2013-03-09 08:54:30 · 311 阅读 · 0 评论 -
九度1489-计算两个矩阵的乘积
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1489C语言源码:#includeint main(){ int i,j,k,a[2][3],b[3][2],ans[2][2]; while(scanf("%d %d %d",&a[0][0],&a[0][1],&a[0][2])!=EOF) { scanf("%d %d %d",原创 2013-03-08 11:09:06 · 255 阅读 · 0 评论 -
杭电HDU1872-稳定排序
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1872当成绩一样时,按输入的顺序排序,不是按名字,读题不细心。C语言源码:#include#include#include#define maxsize 500typedef struct student{ char name[60]; int score; int nu原创 2013-03-03 18:14:00 · 285 阅读 · 0 评论 -
杭电1073
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1073C语言源码:#include#includeint main(){ char a[5001],b[5001],c[5001],d[10]; int n,lena,lenb,p,e; d[0]='\0'; while(scanf("%d",&n)!=EOF) { ge原创 2012-05-30 22:06:44 · 516 阅读 · 0 评论 -
杭电1330
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1330C语言源码:#includeint main(){ double sum; int i,n,j; j=0; while(scanf("%d",&n)!=EOF) { sum=0; for(i=1;i<=n;i++) sum+=1.0/(2.0*i); i原创 2012-04-23 13:05:58 · 217 阅读 · 0 评论 -
杭电1302
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1302C语言源码:#includeint main(){ float i,h,u,d,f,length,pre; int day; scanf("%f%f%f%f",&h,&u,&d,&f); while(h) { day=1; length=u; pre=u;原创 2012-04-14 13:44:18 · 339 阅读 · 0 评论 -
杭电1234
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1234C语言源码:#include#includeint main(){ int n,m,i,time,min,max,open,close,x; char s[10000][15]; while(scanf("%d",&m)!=EOF) { while(m--) {原创 2012-04-11 15:12:24 · 453 阅读 · 0 评论 -
杭电1326
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1326C语言源码:#include#includeint main(){ int i,n,h[101],num,ave,sum; num=1; scanf("%d",&n); while(n) { ave=0; for(i=1;i<=n;i++) { sca原创 2012-04-14 15:35:38 · 263 阅读 · 0 评论 -
杭电1202
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1202C语言源码:#includeint main(){ int n,i,num; double s1,s2,p,gpa; while(scanf("%d",&n)!=EOF) { s2=0; gpa=0; num=0; for(i=1;i<=n;i++) {原创 2012-04-10 15:32:24 · 375 阅读 · 0 评论 -
杭电1205
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1205提示:只要除了数目最多的糖果max之外,其余糖果数目的和(注意要用int64)加1大于等于max,则能吃完,否则不能。C语言源码:#include#includeint main(){ _int64 t,n,i,sum,max,a; while(scanf("%I64d"原创 2012-04-11 14:35:44 · 436 阅读 · 0 评论 -
杭电1266
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1266C语言源码:#include#includeint main(){ int n,i,zero,j; char s[10001]; while(scanf("%d",&n)!=EOF) { while(n--) { getchar(); scanf("%原创 2012-04-13 13:40:12 · 238 阅读 · 0 评论 -
杭电1062
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1062C语言源码:#include#includeint main(){ int n,i,flag,j; char s[1001]; while(scanf("%d",&n)!=EOF) { getchar();//scanf会把回车一起输到缓冲区,gets不会! wh原创 2012-05-30 20:49:10 · 521 阅读 · 0 评论 -
杭电1002
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1002C语言源码:#include#includeint main(){ int n,i,num,lena,lenb,lenc; char a[1001],b[1001]; int c[1002]; while(scanf("%d",&n)!=EOF) { for(num原创 2012-05-29 06:05:45 · 316 阅读 · 0 评论 -
杭电1039
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1039C语言源码:#include#includeint judge(char s){ if(s=='a'||s=='e'||s=='i'||s=='o'||s=='u') return 1; else return 0;}int main(){ int i,a,b原创 2012-05-29 12:09:24 · 400 阅读 · 0 评论 -
杭电1323
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1323C语言源码:#includeint sum(int n){ int i,sum; sum=0; i=1; while(i<n) { if(n/i*i==n) sum+=i; i++; } return sum;}int main(){ int n原创 2012-04-14 15:08:12 · 256 阅读 · 0 评论 -
杭电1201
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1201C语言源码:#includeint judge(int n){ if((n%4==0&&n%100!=0)||(n%400==0)) return 1; else return 0;}int main(){ int n,i,year,month,day,sum;原创 2012-04-10 22:35:03 · 322 阅读 · 0 评论 -
杭电1283
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1283C语言源码:#include#includeint main(){ int i,m1,m2,r1,r2,r3; char s[201]; while(scanf("%d%d",&m1,&m2)!=EOF) { getchar(); scanf("%s",s);原创 2012-04-14 12:17:30 · 223 阅读 · 0 评论 -
杭电1219
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1219C语言源码:#include#includeint main(){ int i,n[26]; char s[100001]; while(gets(s)) { for(i=0;i<26;i++) n[i]=0; for(i=0;i<(int)strlen(s原创 2012-04-11 14:48:39 · 233 阅读 · 0 评论 -
杭电1235
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1235C语言源码:#includeint main(){ int n,a[1001],i,p,num; scanf("%d",&n); while(n) { num=0; for(i=1;i<=n;i++) scanf("%d",&a[i]); scanf("%原创 2012-04-11 15:19:32 · 205 阅读 · 0 评论 -
杭电1303
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1303C语言源码:#includeint main(){ int i,j,top,x,num; float a[20]; scanf("%d",&x); while(x!=-1) { top=0; num=0; while(x!=0) { a[top++]原创 2012-04-14 22:35:19 · 242 阅读 · 0 评论 -
杭电1279
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1279C语言源码:#includeint main(){ int n,num,flag; while(scanf("%d",&n)!=EOF) { while(n--) { scanf("%d",&num); flag=0; while(num!=1)原创 2012-04-13 13:50:39 · 201 阅读 · 0 评论 -
杭电1236
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1236C语言源码:#include#includetypedef struct{ char s[21]; int p;}stu;void change(int *a,int low,int high,stu student[])//首先按学号排序{ int i,j,k;原创 2012-04-12 14:32:49 · 291 阅读 · 0 评论 -
杭电HDU1873-看病要排队
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1873C语言源码:#include#include#include#define maxsize 3000typedef struct patient{ int num; int rank;}patient;patient p1[maxsize],p2[maxsize],p3[原创 2013-03-03 18:37:00 · 291 阅读 · 0 评论 -
杭电1020
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020C语言源码:#include#includeint main(){ int n,i,flag; char s[10001]; int a[26]; while(scanf("%d",&n)!=EOF) { while(n--) { for(i=0;i<26原创 2012-05-29 06:51:01 · 267 阅读 · 0 评论 -
杭电1334
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1334C语言源码:#includeint main(){ int a,b,c,d; a=6; while(a<=200) { for(b=2;b<=197;b++) { for(c=b+1;c<=198;c++) { for(d=c+1;d<=199;原创 2012-05-02 11:43:02 · 242 阅读 · 0 评论 -
杭电1282
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1282C语言源码:#include_int64 ver(_int64 n)//要用64位的类型,要不过不了!{ _int64 d1,d2,m; d1=10; m=0; d2=1; while(n/d1) d1*=10; d1/=10; while(n) { m+=原创 2012-04-13 15:01:26 · 297 阅读 · 0 评论 -
九度-出操队形
题目地址:http://ac.jobdu.com/problem.php?cid=1036&pid=22用O(nlgn)复杂度的LIS算法#includeconst int maxsize=1000010;int A[2][maxsize],B[2][maxsize],dp[2][maxsize];void LIS(int flag,int n){ int left,rig原创 2013-06-21 15:13:29 · 483 阅读 · 0 评论