algorithm
[c++] 모두의 약수
tonirr
2020. 11. 28. 19:55
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int cnt[50001];
int main() {
//freopen("input.txt", "rt", stdin);
int n, i, j;
scanf("%d", &n);
for(i=1; i<=n; i++){
for(j=i; j<=n; j=j+i){
cnt[j]++;
}
}
for(i=1; i<=n; i++){
printf("%d ", cnt[i]);
}
return 0;
}