#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<iterator>
#include<map>
using namespace std;
int main()
{
string time[31] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "quarter",
"sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty one",
"twenty two", "twenty three", "twenty four", "twenty five", "twenty six",
"twenty seven", "twenty eight", "twenty nine", "half"};
//while(1){
int H, M;
scanf("%d%d", &H, &M);
if(M == 0){
cout << time[H] << " o' clock" << endl;
}else if(M > 30){
H += 1; M = 60 - M;
if(H == 24) H = 0;
if(M == 1){
cout << time[M] << " minute to " << time[H] << endl;
}else if(M == 15){
cout << time[M] << " to " << time[H] << endl;
}else{
cout << time[M] << " minutes to " << time[H] << endl;
}
}else{
if(M == 1){
cout << time[M] << " minute past " << time[H] << endl;
}else if(M == 15 || M == 30){
cout << time[M] << " past " << time[H] << endl;
}else{
cout << time[M] << " minutes past " << time[H] << endl;
}
}
//}
return 0;
}
hackerrank The Time in Words
最新推荐文章于 2018-09-22 13:56:46 发布