poj 3751 时间日期格式转换
2015-10-12 14:17
337 查看
题目链接:http://poj.org/problem?id=3751
题目大意:按照要求的格式将输入的时间日期进行转化。
题目大意:按照要求的格式将输入的时间日期进行转化。
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 int main () 5 { 6 int t; 7 cin>>t; 8 while (t--) 9 { 10 int y,m,d,xs,fz,ms; 11 char ch1,ch2,ch3,ch4,ch5; 12 //scanf("%d/%d/%d-%d:%d:%d",y,m,d,xs,fz,ms); 13 //printf ("%d/%d/%d-%d:%d:%d",m,d,y,xs,fz,ms); 14 scanf("%d%c%d%c%d%c%d%c%d%c%d",&y,&ch1,&m,&ch2,&d,&ch3,&xs,&ch4,&fz,&ch5,&ms); 15 char q,p; 16 if (xs>=12) 17 { 18 q='p'; 19 p='m'; 20 } 21 else 22 { 23 q='a'; 24 p='m'; 25 } 26 if (xs==0) 27 xs=12; 28 xs=(xs>12?xs-12:xs); 29 printf ("%02d/%02d/%04d-%02d:%02d:%02d%c%c\n",m,d,y,xs,fz,ms,q,p); 30 } 31 return 0; 32 }
相关文章推荐
- poj 1298 The Hardest Problem Ever
- poj 2000 Gold Coins
- hdu 1253 胜利大逃亡(简单题)
- hdu 1016 Prime Ring Problem (素数环)
- IOS CoreText.framework --- 段落样子CTParagraphStyle
- 解读Unity中的CG编写Shader系列3——表面剔除与剪裁模式
- 窗口加载Bitmap
- Android控件WebView显示网页
- MFC中如何将焦点设置到指定控件上
- oracle wm_concat(column)函数的使用
- UIApplication sharedApplication详细解释-IOS
- JSPatch 可以让你用 JavaScript 书写原生 iOS APP
- SpringMVC 源代码深度解析<context:component-scan>(扫描和注册的注解Bean)
- 对NavigationController/Bar/Item、self.navigationItem/self.navigationController.navigationItem区别的理解
- hdoj Billboard 2795 (线段树 变换) 好题
- JSP实现网页访问统计
- 【算法】贪心算法(0-1背包问题)
- lesson4-类的动态加载
- 解决PKIX:unable to find valid certification path to requested target 的问题
- Rails读书笔记第七章