Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int calc_divisor(int n) {
- int cnt[101]={};
- int num_divisor=1;
- int i;
- for(i=2;i<=n;i++) {
- while(n%i==0){
- cnt[i]++;
- n/=i;
- }
- }
- for(i=2;i<=n;i++) num_divisor*=(cnt[i]+1);
- return num_divisor;
- }
- int main() {
- int i;
- cin>>N;
- for(i=1;i<=N;i++)
- cout<<i<<" "<<calc_divisor(i)<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment