Approximation
ABC 407Problem 9 of 50
EasyWhat to do
Given two positive integers `a` and `b`, find the integer closest to a / b. For example, 4 / 7 ≈ 0.57, so the closest integer is 1. Use standard rounding (round half away from zero since b is always odd).
Key Concepts
basic math
finding the closest integer
input and output handling
Examples
Input:
a = 4, b = 7
Output:
1
Input:
a = 407, b = 29
Output:
14
Tips for Beginners
- Focus on understanding the logic, not memorizing syntax
- Use print statements to debug your code
- Don't worry about input parsing - the function handles that for you
- If stuck, try writing out your solution on paper first
Python Editor
Loading Python...