题目大意:
给你$n,m$,求$displaystyle{sum_{i=1}^{n}sum_{j=1}^{m}}min(lfloorfrac{n}{i}
floor,lfloorfrac{m}{j}
floor) imes[gcd(i,j)=1]$
思路:
化简得原式$=n imes m$。
1 #include<cstdio> 2 #include<cctype> 3 typedef long long int64; 4 inline int getint() { 5 register char ch; 6 while(!isdigit(ch=getchar())); 7 register int x=ch^'0'; 8 while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0'); 9 return x; 10 } 11 int main() { 12 const int n=getint(),m=getint(),p=getint(); 13 printf("%d ",int((int64)n*m%p)); 14 return 0; 15 }