fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int MAXN = 4 * 7;
  5. const int MINT = 15 * 60;
  6. const int MAXT = 60 * 60;
  7.  
  8. int C[] = {6,2,5,5,4,5,6,3,7,6};
  9. int B[1 + MAXN], W[1 + MAXN];
  10.  
  11. string get_time(int t)
  12. {
  13. int m = t / 60;
  14. int s = t % 60;
  15. stringstream ss;
  16. ss << setfill('0') << setw(2) << m << ":" << setw(2) << s;
  17. return ss.str();
  18. }
  19.  
  20. int main()
  21. {
  22. for (int t = MINT; t < MAXT; ++t) {
  23. int m = t / 60;
  24. int s = t % 60;
  25. int n = C[m / 10] + C[m % 10] + C[s / 10] + C[s % 10];
  26. if (B[n] == 0) {
  27. B[n] = t;
  28. }
  29. W[n] = t;
  30. }
  31. int t;
  32. cin >> t;
  33. while (t--) {
  34. int n;
  35. cin >> n;
  36. cout << get_time(B[n]) << " " << get_time(W[n]) << endl;
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0s 4440KB
stdin
2
9
20
stdout
17:11 17:11
15:08 59:54