PROBLEM 16
Easy

Seconds to Clock

Programming Basics · C++

</>
STATUS Not solved

TASK

Problem

#16

In “Seconds to Clock”, input integer data and print hours, minutes, and seconds.

EXAMPLE

Example

Input
59
Output
0 0 59

LIMITS

Constraints

0 ≤ n ≤ 10^12.
📖
LEARN Theory for this problem
+

For non-negative integers, `/` gives the integer quotient and `%` gives the remainder.

Connection to “Seconds to Clock”: here, integer `/` and `%` provide the quotient and remainder, which is useful for digit extraction and cyclic arithmetic.

💡
NEED HELP? Hints
+

['Choose division and remainder operations that match the requested decomposition.', 'After solving “Seconds to Clock”, verify the algorithm on your own small example and on an allowed boundary case. Print only the required result with no extra text.']

ANSWER Solution
+
#include <iostream>
using namespace std;
int main() {
    long long n;
    cin >> n;
    cout << n / 3600 << ' ' << (n % 3600) / 60 << ' ' << n % 60 << '\n';
    return 0;
}