解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class C1541 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { F(sc.nextInt()); } sc.close(); } private static void F(int n){ long rs = n; int k = n; int temp = 0; for(int i = 2; i <= k/2; i++){ if(k % i == 0){ k /= i; if(temp != i){ rs = (rs/i)*(i-1); temp = i; } i = 1; } } if(k != temp) rs = (rs/k)*(k-1); System.out.println(rs); } }
0.0分
1 人评分