Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <algorithm>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <map>
- #include <set>
- #include <unordered_map>
- #include <unordered_set>
- using namespace std;
- #define ll long long
- #define nl "\n"
- #define cy cout << "YES\n"
- #define cn cout << "NO\n"
- #define sz(s) s.size()
- #define all(v) v.begin(), v.end()
- #define cin(vec) for (int i = 0; i < n && cin >> vec[i]; i++)
- #define cout(vec) for (int i = 0; i < n && cout << vec[i] << " "; i++)
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- bool is_confusing(int a, int b, int c, int d)
- {
- if ((a == 2 && c > 3) || b > 5)
- {
- return false;
- }
- return true;
- }
- void solve()
- {
- int a, b, c, d;
- cin >> a >> c;
- b = a % 10;
- a /= 10;
- d = c % 10;
- c /= 10;
- while (true)
- {
- if (is_confusing(a, b, c, d))
- {
- if (a > 0)
- cout << a;
- cout << b << " " << c;
- if (d > 0)
- cout << d;
- break;
- }
- else
- {
- if (c < 5 && d < 9)
- d++;
- else if (c < 5 && d == 9)
- {
- c++;
- d = 0;
- }
- else if (c == 5 && d < 9)
- d++;
- else if (c == 5 && d == 9)
- {
- if (a == 1 && b < 9)
- {
- b++;
- }
- else if (a == 1 && b == 9)
- {
- a = 2;
- b = 0;
- }
- else if (a == 2 && b < 3)
- b++;
- else
- {
- a = 0, b = 0;
- }
- c = 0, d = 0;
- }
- }
- }
- }
- int main()
- {
- sherry();
- ll t = 1;
- // cin >> t;
- while (t--)
- {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement