Floor And Ceil Division

Floor And Ceil Division

Hard Computer Mathematics Integers & Divisibility 30 views
Explanation Complexity

Problem Statement

Given integers a and b>0, print floor(a/b) and ceil(a/b).

Input Format

Two integers a b.

Output Format

Two integers: floor ceil.

Example

7 3
2 3

Constraints

b > 0, |a|

Input / Output Format

Input Format
Two integers a b.
Output Format
Two integers: floor ceil.
Constraints
b > 0, |a|

Examples

Input:
7 3
Output:
2 3

Example Solution (Public)

Computer Mathematics
floor = Math.floor(a/b) for real division. For ceil: if a%b==0 then a/b else floor+1 when a>0, handle negatives carefully using integer rules.

Official Solution Code

floor = Math.floor(a/b) for real division. For ceil: if a%b==0 then a/b else floor+1 when a>0, handle negatives carefully using integer rules.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.