Saleh127

Untitled

May 12th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define sc(a) scanf("%lld",&a)
  6. #define sc2(a,b) scanf("%lld %lld",&a,&b)
  7. int main()
  8. {
  9. ll a[100005]={0},c,d,e,f,i,j,k,l;
  10. cin>>c;
  11. for(i=2;i<=c+1;i++)
  12. {
  13. for(j=2;j*j<=i;j++)
  14. {
  15. if(i%j==0)
  16. {
  17. a[i]=1;
  18. }
  19. }
  20. }
  21. if(c<=2) cout<<1<<endl;
  22. else cout<<2<<endl;
  23. for(i=2;i<=c+1;i++)
  24. {
  25. if(a[i]==0) cout<<1<<" ";
  26. else cout<<2<<" ";
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment