#P7788. [COCI 2016/2017 #6] Savrsen
[COCI 2016/2017 #6] Savrsen
Description
A number is perfect if and only if it is equal to the sum of all its divisors that are smaller than it.
For example, , so is perfect.
Based on this, we define the imperfection value of a number, which is the absolute value of the difference between and the sum of all divisors of that are smaller than .
For example, .
.
.
Now you are given two positive integers and . Please compute .
Input Format
One line with two integers and , as described above.
Output Format
One line with one integer, representing .
1 9
21
24 24
12
Hint
Sample Explanation #1
.
Constraints
For of the testdata, .
Notes
The score of this problem follows the original COCI settings, with a full score of .
Translated from COCI2016_2017 CONTEST #6 T4 SAVRSEN.
Translated by ChatGPT 5
京公网安备 11011102002149号