scg9767   2년 전

오류가 나는데 이유를 모르겠습니다..

#include

void insertionSort(int a[],int b){
int j;
for (int i=1; i=0 && a[j]>key; j--){
a[j+1]=a[j];
}
a[j+1]=key;
}
}
int main() {
int a;
int d;
int b[10004]={0};
int count=0;
scanf("%d%d",&a,&d);
int i=1;
while (b[i]!=1){
b[i]=a/i;
i++;
count++;
}
for (int j=1; j<=count; j++)
b[j-1]=b[j];
insertionSort(b,count);
printf("%d",b[d-1]);


return 0;
}

zenith82114   2년 전

이 부분이 정말 약수를 구하는 것이 맞는지 생각해 보세요. 나눠서 나머지가 없을 때만 약수라고 말합니다.

댓글을 작성하려면 로그인해야 합니다.