Skip to content

Instantly share code, notes, and snippets.

@chermehdi
Created December 8, 2017 21:31
Show Gist options
  • Save chermehdi/3ebadf31e29e0a0bf115a09e965f669c to your computer and use it in GitHub Desktop.
Save chermehdi/3ebadf31e29e0a0bf115a09e965f669c to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(){
int t, h, m, x;
scanf("%d", &t);
while(t--){
scanf("%d:%d %d", &h, &m, &x);
while(x){
m--;
if(m == -1){
h--;
m = 59;
if(h == -1){
h = 23;
}
}
x--;
}
printf("%02d:%02d\n", h, m);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment