#include<bits/stdc++.h> using namespace std; int main(){ int n,b,sum=1,a; cin>>n>>b; for(int i=2;i<=n;i++){ int q=i; for(int j=2;j<=q;j++){ while(q%j==0){ q/=j; a=j; } } if(a<=b){ sum++; } } cout<<sum; return 0; }
求助!(本人新手,只学到自定义函数,勿喷)