题目链接:https://vjudge.net/problem/POJ-2407 题意:给出n,求0..n-1中与n互质的数的个数. 思路:欧拉函数板子题,先根据唯一分解定理求出n的所有质因数p1,p2,...,pn,然后根据Φ(m)=m*∏(1-1/pi)计算即可. AC代码: #include<cstdio> using namespace std; int n,ans; int main(){ while(scanf("%d",&n),n){ ans=n; ;…
Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13598 Accepted: 6771 Description Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if ther…