健康运动-合理运动方案[我写绿色IT]
2008-09-08 14:51
232 查看
原题:
Description Ordinal numbers refer to a position in a series. Common ordinals include zeroth, first, second, third, fourth and so on. Ordinals are not often written in words, they are written using digits and letters. An ordinal indicator is a sign adjacent to a numeral denoting that it is an ordinal number, rather than a cardinal number. In English, the suffixes -st (e.g. 21st), -nd (e.g. 22nd), -rd (e.g. 23rd), and -th (e.g. 24th) are used. The rules are as follows: If the tens digit of a number is 1, then write "th" after the number. For example: 13th, 19th, 112th, 9311th.
If the tens digit is not equal to 1, then use "st" if the units digit is 1, "nd" if the units digit is 2, "rd" if the units digit is 3, and "th" otherwise: For example: 2nd, 7th, 20th, 23rd, 52nd, 135th, 301st.
Input There are multiple test cases. The first line of input is an integer T ≈ 1000 indicating the number of test cases.
Each test case consists of a cardinal number 0 ≤ n < 1,000,000,000.
Output For each test case, output the corresponding ordinal number.
Sample Input
分析:
题意就是让输出对应的英文缩写。。。
上原码:
本文出自 “丙三醇” 博客,请务必保留此出处http://bingsanchun.blog.51cto.com/7608078/1271374
Description Ordinal numbers refer to a position in a series. Common ordinals include zeroth, first, second, third, fourth and so on. Ordinals are not often written in words, they are written using digits and letters. An ordinal indicator is a sign adjacent to a numeral denoting that it is an ordinal number, rather than a cardinal number. In English, the suffixes -st (e.g. 21st), -nd (e.g. 22nd), -rd (e.g. 23rd), and -th (e.g. 24th) are used. The rules are as follows: If the tens digit of a number is 1, then write "th" after the number. For example: 13th, 19th, 112th, 9311th.
If the tens digit is not equal to 1, then use "st" if the units digit is 1, "nd" if the units digit is 2, "rd" if the units digit is 3, and "th" otherwise: For example: 2nd, 7th, 20th, 23rd, 52nd, 135th, 301st.
Input There are multiple test cases. The first line of input is an integer T ≈ 1000 indicating the number of test cases.
Each test case consists of a cardinal number 0 ≤ n < 1,000,000,000.
Output For each test case, output the corresponding ordinal number.
Sample Input
5 1 2 3 4 1024Sample Output
1st 2nd 3rd 4th 1024th
分析:
题意就是让输出对应的英文缩写。。。
上原码:
#include<stdio.h> int main() { int t, n, m; scanf("%d", &t); while(t--) { scanf("%d", &n); if((n / 10) % 10 == 1) printf("%dth\n", n); else { m = n % 10; printf("%d", n); if(m == 1) puts("st"); else if(m == 2) puts("nd"); else if(m == 3) puts("rd"); else puts("th"); } } return 0; }
本文出自 “丙三醇” 博客,请务必保留此出处http://bingsanchun.blog.51cto.com/7608078/1271374
相关文章推荐
- IT人必备的运动&&测测你的心理健康【我写绿色IT】 推荐
- 步行——适合IT人的最好运动[我写绿色IT]
- IT人员面对非IT人员工作方案时需要咨询的10大问题
- SafeNet基于 Web的PIN保护解决方案―低碳时代绿色环保方案先行
- 运动+饮食+好心情 IT人员健康三剑客
- 如何利用ROS MoveIt快速搭建机器人运动规划平台?
- 发改委印发《“互联网+”绿色生态三年行动实施方案》的通知
- Atitit.跨语言数据库db api兼容性 jdbc odbc ado oledb 增强方案
- 我写绿色IT -学校也要绿色it
- 我写绿色IT:绿色IT请从规划做起 推荐
- 第三届华硕服务器IT硬件平台搭建大赛获奖方案原稿 推荐
- Atitit.兼具兼容性和扩展性的配置方案attilax总结
- 恶梦又来了【我写绿色IT】
- ATOM不争气 INTEL操纵PCMARK2005来黑NANO?[我写绿色IT] 推荐
- 健康饮食——养生之道[我写绿色IT]
- android 阿拉伯语下,图库中编辑运动轨迹图片,动画中会显示绿色的图片
- atitit.web 推送实现方案集合(2)---百度云,jpush 极光推送 ,个推的选型比较.o99
- 九个合理的个人所得税避税方案
- 绿色 . IT . 从小事做起
- 解读新医改方案下的IT架构 推荐