Integer division
Operation | Description | With variables | Example with numbers |
+ | Addition | a + b | 10 + 7 ⇒ 17 |
- | Subtraction | a - b | 10 - 7 ⇒ 3 |
* | Multiplication | a * b | 10 * 7 ⇒ 70 |
/ | Division | a / b | 10 / 7 ⇒ 1.4285714285714286 |
// | Floor division | a // b | 10 // 7 ⇒ 1 |
% | Modulus (remainder after division) | a % b | 10 % 7 ⇒ 3 |
** | Exponent | a**b | 10**7 ⇒ 10000000 |
When dealing with integers, we can do a regular division with
a / b
and we can do a whole division with a // b
which would result in only the whole part after dividing a
by b
. The remainder after division a
by b
can be taken with %
.Given two numbers in the input
x
and y
. Print the result of the whole division x
by y
and the remainder after dividing x
by y
.Input | Output |
10
5 | 2 0 |
9
4 | 2 1 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB