Mock CCC '22 Contest 1 J1 - Square Root Decomposition

View as PDF

Submit solution


Points: 3
Time limit: 0.25s
Memory limit: 256M

Author:
Problem type

Bob is practicing square root decomposition!

The problem Bob is doing involves breaking a number N into B groups. It is said to be optimal if B is closest to N.

He currently has 2 candidates for B: integers i and j. If i and j are squared, which one is closer to N?

The data guarantee that one candidate will be closer than the other.

Constraints

1N,i,j104

ij

Input Specification

The first line will contain N.

The second line will contain i.

The third and final line will contain j.

Output Specification

On one line, output 1 if i2 is closer to N or 2 if j2 is.

Sample Input 1

Copy
9
3
4

Sample Output 1

Copy
1

Sample Input 2

Copy
16
5
3

Sample Output 2

Copy
2

Comments


  • 0
    Raynfall  commented 37 days ago edited

    Possible spoiler, but I had tried to square the distances between N and i/j squared to find the positive distance, but that caused a WA .Since the distances are being compared and their actual value doesn't matter, why wouldn't this work?