A. Balanced Product
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
We say a positive integer x
is balanced if there exist two positive integers a
and b
such that:
a × b
=x
and
|a − b|
≤1
In other words, x
is the product of two equal or consecutive positive integers.
You are given a positive integer n
. Your task is to count how many integers x
satisfy the following conditions: 1 ≤ x ≤ n
and x
is balanced.
Input
A single integer n
,(1 ≤ n ≤ \(10^9\))
Output
Print a single integer — the number of balanced integers between 1
and n
, inclusive.
Sample
Input | Output |
---|---|
|
|
Explanation
Balanced numbers ≤ 15:
1 = 1 × 1
2 = 1 × 2
4 = 2 × 2
6 = 2 × 3
9 = 3 × 3
12 = 3 × 4
Total balanced numbers: 6
Brain Booster #10
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 6
- Start at
- 2025-06-13 15:30
- End at
- 2025-06-13 18:00
- Duration
- 2.5 hour(s)
- Host
- Partic.
- 91