标签:
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxk = 2000 + 10;
int s[maxk],d[maxk];
int dp[maxk];
int main(){
int t;
scanf("%d",&t);
while(t--){
int k;
scanf("%d",&k);
for(int i = 1;i <= k ;++i)
scanf("%d",&s[i]);
for(int i = 1;i < k ;++i)
scanf("%d",&d[i]);
dp[0] = 0;dp[1] = s[1];
for(int i = 2; i <= k ;++i)
dp[i] = min(dp[i - 1] + s[i],dp[i - 2] + d[i - 1]);
int hour = dp[k] / 3600 + 8,minute = dp[k]/60 % 60,second = dp[k] % 60;
printf("%02d:%02d:%02d %s\n",hour%12,minute,second,hour / 12 ?"pm":"am");
}
return 0;
}
[2016-03-27][HDU][1260][Tickets]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/b7e10e1666cfb69228382af90922768c.html