-
时间:2016-03-27 22:37:37 星期日
-
题目编号:[2016-03-27][HDU][1260][Tickets]
-
遇到的问题:分钟数字,除以60以后还要模60 t / 60 % 60
#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;
}
时间: 2024-10-09 20:16:39