-
Time Conversion해커랭크(HackerRank) 2018. 8. 19. 17:41반응형
1. 문제
2. 알고리즘
키워드 - 구현
3. 코드
123456789101112131415161718#include <cmath>#include <cstdio>#include <vector>#include <iostream>#include <algorithm>#include<cstring>using namespace std;int main() {int h,m,s;char c[2];scanf("%d:%d:%d%s",&h,&m,&s,c);if(!strcmp(c,"PM") && h != 12)h+=12;if(!strcmp(c,"AM") && h == 12)h = 0;printf("%02d:%02d:%02d\n",h,m,s);return 0;}cs 반응형'해커랭크(HackerRank)' 카테고리의 다른 글
Mini-Max Sum (0) 2018.08.19 Birthday Cake Candles (0) 2018.08.19 Grading Students (0) 2018.08.19 Day 0: Mean, Median, and Mode (0) 2018.08.19 Breaking the Records (0) 2018.08.19