Redaksiya
Since the value of is not too large, we can iterate through all possible values of from to and check if the condition holds. Count the number of such .
Example
For there are two smooth divisors: and , because
;
Algorithm implementation
Read the input value of .
scanf("%d",&n);
In the variable , count the number of such values of for which the quotient of divided by is equal to the remainder of divided by .
res = 0; for(m = 2; m <= n; m++) if ((n / m) == (n % m)) res++;
Print the answer.
printf("%d\n",res);
Java implementation
import java.util.*; public class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int n = con.nextInt(); int res = 0; for(int m = 2; m <= n; m++) if ((n / m) == (n % m)) res++; System.out.println(res); con.close(); } }
Python implementation
Read the input value of .
n = int(input())
In the variable , count the number of such values of for which the quotient of divided by is equal to the remainder of divided by .
res = 0 for m in range(2,n) : if (n // m == n % m) : res += 1
Print the answer.
print(res)