#include<iostream> using namespace std; const int N=1e5; int T,n; int a[N],b[N]; int dp[N]; int main() { cin>>T; while(T--) { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n-1;i++) cin>>b[i]; dp[1]=a[1]; for(int i=2;i<=n;i++) dp[i]=min(dp[i-1]+a[i],dp[i-2]+b[i-1]); int ss=dp[n]+8*60*60; int h=ss/3600; ss=ss-h*3600; int m=ss/60; ss=ss-m*60; int s=ss; printf("%02d:%02d:%02d ",h,m,s); if(h<12) printf("am"); else printf("pm"); printf("\n"); } }
原文地址:https://www.cnblogs.com/QingyuYYYYY/p/12238330.html
时间: 2024-11-08 20:35:13