A - When?
AtCoder Beginner Contest usually starts at 21:00 JST and lasts for 100 minutes.
You are given an integer K between 00 and 100100 (inclusive). Print the time K minutes after 21:00 in the HH:MM
format, where HH
denotes the hour on the 24-hour clock and MM
denotes the minute. If the hour or the minute has just one digit, append a 0 to the beginning to represent it as a 2-digit integer.
Input is given from Standard Input in the following format:
K
Print the time K minutes after 21:00 in the format specified in the Problem Statement.
63
22:03
6363 minutes after 21:00, it will be 22:03, so 22:03
should be printed.
The following outputs would be judged incorrect:
10:03
22:3
45
21:45
100
22:40
void coder_solution() {
// 提升cin、cout效率
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int k;
cin >> k;
int h = k / 60;
if (21 + h >= 24) {
if ((21 + h) % 24 < 10) {
cout << 0 << (21 + h) % 24;
} else {
cout << (21 + h) % 24;
}
} else {
cout << 21 + h;
}
cout << ':';
if (k % 60 < 10) {
cout << 0 << k % 60;
} else {
cout << k % 60;
}
}
void best_solution() {
// 提升cin、cout效率
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int k;
cin >> k;
int h = k / 60;
cout << 21 + h << ':';
if (k % 60 < 10) {
cout << 0 << k % 60;
} else {
cout << k % 60;
}
}
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int k;
cin >> k;
int h = 21 + k / 60;
int m = k % 60;
cout << h << ":" << m / 10 << m % 10 << '\n';
return 0;
}
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int X;
cin >> X;
int H = X < 60 ? 21 : 22;
int M = X % 60;
printf("%d:%02d", H, M);
return 0;
}