2 3 5 7的倍数(容斥定理)

题目:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1284

容斥定理裸题

定理:

#include<iostream>
using namespace std;

int main()
{
    __int64 int x;
    cin>>x;
    cout<<x-(x/2+x/3+x/5+x/7-x/2/3-x/2/5-x/2/7-x/3/5-x/3/7-x/5/7
    +x/2/3/5+x/2/3/7+x/2/5/7+x/3/5/7-x/2/3/5/7);
}

 

posted @ 2017-09-23 21:20  小九xD  阅读(454)  评论(0编辑  收藏  举报