Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,x[100003],ans=0,t,i,j,c;
- while(scanf("%d",&n)!=EOF){
- ans=0;
- for(i=2;i<=(n/2)+1;i++){
- t=1;
- for(j=i;j<=n;j*=2){
- t++;
- }
- if(ans<=t){ans=t;}
- }
- for(i=2;i<=n;i++){
- c=2;
- for(j=i;j<=n;j+=i){
- if(x[j]==0 && c==2){
- x[j]=c;c++;
- }
- else if(i<j){
- x[j]=c;
- }
- else{
- c=x[j];
- c++;
- }
- // printf("%d %d\n",j,x[j]);
- }
- }printf("%d\n1",ans);
- for(i=2;i<=n;i++){
- cout<<' '<<x[i];
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement