emmmmmm这就触及到我的知识盲区了...
看了大佬博客Orz:https://blog.csdn.net/qq_29600137/article/details/50849698
发现我要看的东西还很多啊QAQ...
这道题用容斥原理真的太巧妙了,短小精悍。直接贴AC代码吧:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long longint main()
{ll n;while(cin>>n){//容斥原理:+奇-偶ll ans=n-(n/2+n/3+n/5+n/7-n/6-n/10-n/14-n/15-n/21-n/35+n/30+n/70+n/42+n/105-n/210);cout<<ans<<endl;}return 0;
}