fork download
  1. /*بسم الله الرحمن الرحيم */
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. #define ll long long
  5. #define Atomic ios_base::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr);
  6. signed main()
  7. {
  8. Atomic
  9. int t;
  10. cin>>t;
  11. while(t--)
  12. {
  13. int h,m;
  14. char c;
  15. cin>>h>>c>>m;
  16. if(h!=0 and h<=12)
  17. {
  18. cout<<h<<c<<m<<" AM"<<endl;
  19. }
  20. else if(h>12 )
  21. {
  22. cout<<h-12<<c<<m<<" PM"<<endl;
  23. }
  24. else
  25. {
  26.  
  27. cout<<h+12<<c<<m<<" AM"<<endl;
  28. }
  29. }
  30.  
  31. return 0;
  32. }
  33.  
  34.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty