#include<stdio.h>
int factor(int aa){
int k,count=0;
for(k=1;k<=aa;k++){
if(aa%k==0)
count++;
}
return count;
}
int main(){
int a[100],f[100]={0},i,j,n,temp,temp1;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
f[i]=factor(a[i]);
}
for(i=0;i<n1;i++){
for(j=0;j<n1i;j++){
if(f[j] > f[j+1]) {
temp1=a[j];
a[j]=a[j+1];
a[j+1]=temp1;
temp = f[j];
f[j] = f[j+1];
f[j+1] = temp;
}
}
}
for(i=n1;i>=0;i){
printf("%d ",a[i]);
}
return 0;
}
int factor(int aa){
int k,count=0;
for(k=1;k<=aa;k++){
if(aa%k==0)
count++;
}
return count;
}
int main(){
int a[100],f[100]={0},i,j,n,temp,temp1;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
f[i]=factor(a[i]);
}
for(i=0;i<n1;i++){
for(j=0;j<n1i;j++){
if(f[j] > f[j+1]) {
temp1=a[j];
a[j]=a[j+1];
a[j+1]=temp1;
temp = f[j];
f[j] = f[j+1];
f[j+1] = temp;
}
}
}
for(i=n1;i>=0;i){
printf("%d ",a[i]);
}
return 0;
}
No comments:
Post a Comment