sicily 2401 Judges' Time Calculation

// source code of submission 757803, Zhongshan University Online Judge System #include <iostream> using namespace std; int main() { int H,M,SH,SM,DH,DM,EH,EM; int n,i,cnt; cin>>n; while(n--) { cin>>SH>>SM>>DH>>DM; cout<<"------+---------"<<endl<<" time | elapsed"<<endl<<"------+---------"<<endl; if(SH>=10&&SH<=12) cout<<SH<<":XX | XX"; else cout<<" "<<SH<<":XX | XX"; if(SM!=0) cout<<" - "<<SM<<endl; else cout<<endl; EH = SH + DH,cnt = DH; if(SM+DM>=60) { EH +=1; EM = (SM+DM)%60; cnt+=1;} i = 1,M = 60 - SM; while(i <= cnt) { H = (SH+i); if(H >12) H = H % 12; if(H>=10&&H<=12) cout<<H<<":XX | XX"; else cout<<" "<<H<<":XX | XX"; cout<<" + "<<M<<endl; M += 60,i++; } } return 0; }

你可能感兴趣的:(sicily 2401 Judges' Time Calculation)