Untitled
unknown
java
a year ago
420 B
7
Indexable
import java.util.Scanner;
public class P1 {
public static int Sol(int n) {
int cnt = 0;
for (int i = 1; i <= Math.sqrt(n); i++) {
if (n % i == 0) {
cnt++;
if (n / i != i) {
cnt++;
}
}
}
return cnt;
}
// 6 = 1, 2, 3, 6
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(Sol(n));
}
}Editor is loading...
Leave a Comment