C++

Timeloop 发表于 1年前 · 关联问题 简单的 RC 签到题

include

using namespace std;

int main(){

long long int n; long int a,b,c,d; long long int count=0; cin>>n>>a>>b>>c>>d; count=(n/a)+(n/b)+(n/c)+(n/d); count-=(n/(a*b)+n/(a*c)+n/(a*d)+n/(b*c)+n/(b*d)+n/(c*d)); count+=(n/(a*b*c)+n/(a*b*d)+n/(a*c*d)+n/(b*c*d))*3; count-=(n/(a*b*c*d))*4*3; count+=(n/(a*b*c*d))*6; count-=(n/(a*b*c)+n/(a*b*d)+n/(a*c*d)+n/(b*c*d)-n/(a*b*c*d)*4)*2; count-=(n/(a*b*c*d))*3; cout<<count; return 0;

}