Accepted solution

UVA 11650 - Mirror Clock Solution in C++

Open original problem
Source code

#include <iostream>

#include<stdio.h>

using namespace std;

int main()

{

    int T;

    cin>>T;

    while(T>0)

    {

        int HH,MM;

        scanf("%d:%d",&HH,&MM);

        if(HH==12 && MM==0)

        {

            printf("%02d:%02d",HH,MM);

        }

        else if(MM==0)

        {

            HH = 12-HH;

            printf("%02d:%02d",HH,MM);

        }

        else

        {

            MM = 60-MM;

            HH = 23 - HH;

            if(HH>12)

            {

                HH = HH-12;

            }

            printf("%02d:%02d",HH,MM);

        }

        T--;

    }

    return 0;

}
Join the discussion

Add your comment