Online Judge练习题
leizh007
这个作者很懒,什么都没留下…
展开
-
杭电HDU1874-畅通工程续
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1874 C语言源码: #include #include #define maxsize 300 int E[maxsize][maxsize]; int visited[maxsize]; int length[maxsize]; int main() { int n,m,i,j,min,fmi原创 2013-03-03 18:50:45 · 184 阅读 · 0 评论 -
杭电HDU1875-畅通工程再续
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1875 C语言源码: #include #include #include #define maxsize 10000 typedef struct edge { int a,b; double length; }edge; edge E[maxsize]; int cmp(const void原创 2013-03-03 19:35:38 · 164 阅读 · 0 评论 -
杭电HDU3794-Magic Coupon
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3794 C语言源码: #include #include #define maxsize 1000010 int cmp1(const void *a,const void *b) { return *(int *)b-*(int *)a; } int cmp2(const void *a,con原创 2013-03-08 10:17:31 · 256 阅读 · 0 评论 -
九度1488-百万富翁问题
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1488 C语言源码: #include #include int main() { printf("%d %d\n",10*30,(int)pow(2,30)-1); }原创 2013-03-08 11:02:09 · 311 阅读 · 0 评论 -
杭电HDU3792-Twin Prime Conjecture
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3792 C语言源码: #include #define maxsize 100000 int 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 · 277 阅读 · 0 评论 -
杭电HDU3793-Is It Symmetric
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3793 C语言源码: #include #include int 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 · 256 阅读 · 0 评论 -
九度1490-字符串链接
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1490 C语言源码: #include int 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 · 210 阅读 · 0 评论 -
九度1485-W's Cipher
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1485 提供组测试数据: 3 0 0 ab C语言源码: #include #define maxsize 10000 char S[maxsize]; int s1[maxsize],s2[maxsize],s3[maxsize],top1,top2,top3; void change(int原创 2013-03-09 08:54:30 · 298 阅读 · 0 评论 -
九度1489-计算两个矩阵的乘积
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1489 C语言源码: #include int 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 · 239 阅读 · 0 评论 -
杭电HDU1872-稳定排序
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1872 当成绩一样时,按输入的顺序排序,不是按名字,读题不细心。 C语言源码: #include #include #include #define maxsize 500 typedef struct student { char name[60]; int score; int nu原创 2013-03-03 18:14:00 · 264 阅读 · 0 评论 -
杭电1073
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1073 C语言源码: #include #include int 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 · 492 阅读 · 0 评论 -
杭电1330
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1330 C语言源码: #include int 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 · 200 阅读 · 0 评论 -
杭电1302
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1302 C语言源码: #include int 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 · 317 阅读 · 0 评论 -
杭电1234
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1234 C语言源码: #include #include int 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 · 431 阅读 · 0 评论 -
杭电1326
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1326 C语言源码: #include #include int 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 · 236 阅读 · 0 评论 -
杭电1202
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1202 C语言源码: #include int 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 · 347 阅读 · 0 评论 -
杭电1205
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1205 提示:只要除了数目最多的糖果max之外,其余糖果数目的和(注意要用int64)加1大于等于max,则能吃完,否则不能。 C语言源码: #include #include int main() { _int64 t,n,i,sum,max,a; while(scanf("%I64d"原创 2012-04-11 14:35:44 · 412 阅读 · 0 评论 -
杭电1266
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1266 C语言源码: #include #include int main() { int n,i,zero,j; char s[10001]; while(scanf("%d",&n)!=EOF) { while(n--) { getchar(); scanf("%原创 2012-04-13 13:40:12 · 224 阅读 · 0 评论 -
杭电1062
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1062 C语言源码: #include #include int main() { int n,i,flag,j; char s[1001]; while(scanf("%d",&n)!=EOF) { getchar();//scanf会把回车一起输到缓冲区,gets不会! wh原创 2012-05-30 20:49:10 · 501 阅读 · 0 评论 -
杭电1002
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1002 C语言源码: #include #include int 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 · 304 阅读 · 0 评论 -
杭电1039
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1039 C语言源码: #include #include int 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 · 379 阅读 · 0 评论 -
杭电1323
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1323 C语言源码: #include int 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 · 240 阅读 · 0 评论 -
杭电1201
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1201 C语言源码: #include int 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 · 292 阅读 · 0 评论 -
杭电1283
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1283 C语言源码: #include #include int 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 · 202 阅读 · 0 评论 -
杭电1219
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1219 C语言源码: #include #include int 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 · 214 阅读 · 0 评论 -
杭电1235
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1235 C语言源码: #include int 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 · 191 阅读 · 0 评论 -
杭电1303
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1303 C语言源码: #include int 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 · 224 阅读 · 0 评论 -
杭电1279
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1279 C语言源码: #include int 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 · 181 阅读 · 0 评论 -
杭电1236
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1236 C语言源码: #include #include typedef 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 · 272 阅读 · 0 评论 -
杭电HDU1873-看病要排队
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1873 C语言源码: #include #include #include #define maxsize 3000 typedef struct patient { int num; int rank; }patient; patient p1[maxsize],p2[maxsize],p3[原创 2013-03-03 18:37:00 · 272 阅读 · 0 评论 -
杭电1020
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020 C语言源码: #include #include int 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 · 253 阅读 · 0 评论 -
杭电1334
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1334 C语言源码: #include int 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 · 227 阅读 · 0 评论 -
杭电1282
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1282 C语言源码: #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 · 275 阅读 · 0 评论 -
九度-出操队形
题目地址:http://ac.jobdu.com/problem.php?cid=1036&pid=22 用O(nlgn)复杂度的LIS算法 #include const 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 · 462 阅读 · 0 评论