标签:
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=2059
1 #include<stdio.h> 2 3 int L, i, j; 4 int n, c, t; 5 int vr, vt1, vt2; 6 double a[110] = {0}; 7 int p[110] = {0}; 8 9 double min(double a, double b){return a < b? a:b;} 10 11 double count(double e, double s) 12 { 13 if(s-e < c) return (s-e) / vt1; 14 else return c*1.0/vt1 + (s-e-c)/vt2; 15 } 16 17 main() 18 { 19 20 while(~scanf("%d", &L)) 21 { 22 scanf("%d %d %d", &n, &c, &t); 23 scanf("%d %d %d",&vr, &vt1, &vt2); 24 for(i=1; i<=n; i++) 25 { 26 scanf("%d", &p[i]); 27 } 28 a[0] = -t, p[0] = 0, p[n+1] = L; 29 for(i=1; i<=n+1; i++) 30 { 31 a[i] = 1e9; 32 for(j=0; j<=i-1; j++) 33 { 34 a[i] = min(a[i], a[j]+t+count(p[j], p[i])); 35 } 36 } 37 if(a[n+1]*vr < 1.0*L) 38 printf("What a pity rabbit!\n"); 39 else 40 printf("Good job,rabbit!\n"); 41 } 42 }
标签:
原文地址:http://www.cnblogs.com/forerve/p/4339607.html