Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define ff first
- #define ss second
- #define pb push_back
- int main()
- {
- int test;
- cin>>test;
- while(test--){
- string s;
- cin>>s;
- int h = (s[0]-'0')*10 + (s[1]-'0');
- int f = 0;
- if(h >= 12) h-=12, f=1;
- if(h == 0) h=12;
- string hh = to_string(h);
- if(hh.size() == 1) hh = "0"+hh;
- if(f)
- cout<<hh<<":"<<s[3]<<s[4]<<" PM\n";
- else
- cout<<hh<<":"<<s[3]<<s[4]<<" AM\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement