Time Conversion 1
0.5s 256MWe know that one hour is \(60\) minutes. Given \(S\) minutes, compute how many whole hours and remaining minutes it represents.
Syntax Restrictions
In short, solve this problem using only integer variable declarations, assignment operations, cin, cout, and arithmetic with +, -, *, /, and %. Expand the list below only if you want the full details.
This is a basic practice problem for standard input/output and integer arithmetic. To keep the focus on reading input, printing output, and deriving the answer with +, -, *, /, and %, submissions may use only the most basic C++ syntax. Your source code is checked automatically during judging; a submission that breaks the restrictions is judged SR (Syntax Restriction), and the judge feedback lists where the violation is.
Click to expand: allowed and forbidden syntax
Allowed:
#include <iostream>(the only allowed include)using namespace std;- the
int main()function andreturn 0; - declaring integer variables (e.g.
int,long long) - reading with
cin >>and printing withcout <<(>>may only followcin,<<may only followcout; you may print integers, variables, arithmetic results, and string or character literals, such ascout << "Hello" << '\n';,cout << "Hello\n";, andcout << answer << '\n';) - arithmetic operators:
+,-,*,/,% - assignment operators:
=,+=,-=,*=,/=,%= - comments (
//and/* */)
Forbidden (common examples):
If some items below are completely unfamiliar, that is expected: they are not required at this practice stage and are not needed for this problem. You do not need to learn them now; just do not use them here.
- conditionals and loops:
if,else,for,while,do,switch,?: - comparison and logical operators:
<,>,<=,>=,==,!=,&&,||,! ++,--- arrays
[], and types/containers such asbool,float,double,string - calling or defining any function other than
main(e.g.max,abs,pow,sqrt,getline) - any header other than
<iostream>, and preprocessor directives such as#define
Input
The input contains a single integer \(S\).
Constraints
- \(0 \le S \le 1439\)
Output
Print two integers \(h\) and \(m\) separated by one space, where \(0 \le m < 60\), meaning that \(S\) minutes equals \(h\) hours and \(m\) minutes.
Sample Input 1
10
Sample Output 1
0 10
Sample Input 2
100
Sample Output 2
1 40
Log in to write and submit code. Creating an account is free.