Time decomposition (2) P22654


Statement
 

pdf   zip   main.cc

Write a procedure

    void decompose(int n, int& h, int& m, int& s);

that, given a quantity of seconds @n@, computes how many hours @h@, minutes @m@ and seconds @s@ it represents. That is, we must have @s@ +60+ \ 60@m@ +3600+ \ 3600@h@ == @n@, with 00\le @s@ <60<60 and 00\le @m@ <60<60.

Precondition

nn is a natural number.

Observation

You only need to submit the required procedure; your main program will be ignored.

Public test cases
  • Input/Output

    decompose(147) → 0 2 27
    decompose(100000) → 27 46 40
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++