#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<cstdlib> #include<vector> #define db(a) cout << #a << " = " << a << endl; #define db2(a, b) cout << #a << " = " << a << " " << #b << " = " << b << endl; #define foreach(it, l) for(typeof(l.begin()) it = l.begin(); it != l.end(); it++) using namespace std; string reves(int a) { char arr[10]; sprintf(arr, "%02d", a); int len = strlen(arr); reverse(arr , arr + len); return arr; } int main() { int H, M; string hora; while(cin >> hora) { char res[10]; bool find = false, first = true; sscanf(hora.c_str(), "%d:%d", &H, &M); for (int h = 0; h < 24 && !find; h++) { int m = 0; if(first) { m = M + 1; first = false; } for (; m < 60 && !find; m++) { char mc[10]; sprintf(mc, "%02d", m); if(reves((h + H) % 24) == mc) sprintf(res, "%02d:%02d", (h + H) % 24, m), find = true; } } cout << res << endl; } return 0; }
miércoles, 19 de octubre de 2011
Reloj - CodeForces
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario