hackerrank The Time in Words
来源:互联网 发布:白苹果保留数据刷机 编辑:程序博客网 时间:2024/05/24 01:16
#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;}
阅读全文
0 0
- hackerrank The Time in Words
- HackerRank: Play with words
- useful words in the work
- [HackerRank] Time Conversion
- THE FIRST TIME coming in!
- The first time in CSDN.
- BLESSING WORDS IN THE NEW YEAR
- Hackerrank Cut the sticks
- HackerRank The Maximum Subarray
- Hackerrank Connect the country
- Reverse the words in a sentence in place
- The Oxford Dictionary of New Words: A Popular Guide to Words in the News
- The first time in My Life
- The first time blog in CSDN
- How time flies! the feeling in America
- modification time xx in the future解决办法
- tar:time stamp in the future
- Superblock mount time is in the future
- mysql 表的连接
- Orphan notification poll 机制
- 关于centos7和centos6中平滑升级nginx到新版本v1.12.1修复nginx最新漏洞CVE-2017-7529的解决方案
- 细粒度图像分析进展综述
- 大脑的研究方法
- hackerrank The Time in Words
- 普通表单与响应式表单的对比
- java递归树
- MultipartFile 转 file
- POJ 1716(spfa最长路
- 减少倒计时误差
- 图解原型原型链
- Sublime Text 插件:批量删除空白行
- spring filter的targetFilterLifecycle作用