标签:des style blog http color java os strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 972 Accepted Submission(s): 495
#include<iostream> using namespace std; int a[2001],b[2001],dp[2001]; #define min(x,y) (x)<(y)? (x):(y) int n; void pre() { int i,j; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=2;i<=n;i++) cin>>b[i]; } void solve() { int i,j; dp[0]=0;dp[1]=a[1]; for(i=2;i<=n;i++) dp[i]=min(dp[i-1]+a[i],dp[i-2]+b[i]); int num=dp[n]; int h,m,s; h=num/60/60;num-=h*60*60; m=num/60;num-=m*60; s=num; printf("%02d:%02d:%02d",h+8>12? h+8-12:h+8,m,s); printf(" %s\n",h+8>12? "pm":"am"); } int main(void) { int t,i,j; while(cin>>t){ while(t--){ pre(); solve(); } } return 0; }
HDU Tickets(简单的dp递推),布布扣,bubuko.com
标签:des style blog http color java os strong
原文地址:http://www.cnblogs.com/woshijishu3/p/3888682.html