Skip to content

Commit

Permalink
Merge pull request #38 from divya144/master
Browse files Browse the repository at this point in the history
Added solution of  a problem of SPOJ
  • Loading branch information
haritha1313 authored Oct 13, 2019
2 parents a498a6a + 7a1cba9 commit 8a0c126
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions c++/AE00.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <bits/stdc++.h>
using namespace std;
int factor(int num){
int count=0;
for(int i=1;i<=num;i++)
{
if(num%i==0)
count++;
}
return count;
}

int main() {
int N;
cin>>N;
int ans;
for(int i=1;i<=N;i++){
int temp=factor(i);
if(temp%2==0)
ans=ans+temp/2;
else
ans=ans+temp/2+1;
}
cout<<ans<<endl;
return 0;
}

0 comments on commit 8a0c126

Please sign in to comment.