BZOJ 2045 容斥原理
思路:
同BZOJ 2005
http://blog.csdn.net/qq_31785871/article/details/54314774
//By SiriusRen
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
int a,b,d,mn,f[1000050];
signed main(){
scanf("%lld%lld%lld",&a,&b,&d),mn=min(a,b);
for(int i=mn;i>=d;i--){
f[i]=(a/i)*(b/i);
for(int j=2;i*j<=mn;j++)
f[i]-=f[i*j];
}
printf("%lld\n",f[d]);
}