11650

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>

using namespace std;


void printTime(int tyme)
{
	if(tyme<10)
	{
		printf("0%d\n",tyme);
	}
	else
	{
		printf("%d\n",tyme);
	}
}
int main()
{
	int t,hour,min;
	scanf("%d",&t);
	char s[10];
	int highest = 12*60;
	int lowest = 0;
	int mirror;
	while(t--)
	{
		scanf("%s",s);
		hour = (s[0]-'0')*10;
		hour += (s[1]-'0');

		hour%=12;
		min = (s[3]-'0')*10;
		min += (s[4]-'0');

		min = hour*60+min;
		mirror = highest-min;

		hour = mirror/60;
		min = mirror%60;
		if(hour==0)
		{
			printf("12:");
			printTime(min);
		}
		else if(hour<10)
		{
			printf("0%d:",hour);
			printTime(min);
		}
		else
		{
			printf("%d:",hour);
			printTime(min);
		}
	}
	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *