From 7a1cba914c47b2e5f66c7e9891cbb8d8117d5c56 Mon Sep 17 00:00:00 2001 From: Divya Gupta <38471510+divya144@users.noreply.github.com> Date: Tue, 1 Oct 2019 12:49:46 +0530 Subject: [PATCH] Added solution of a problem of SPOJ --- c++/AE00.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 c++/AE00.cpp diff --git a/c++/AE00.cpp b/c++/AE00.cpp new file mode 100644 index 0000000..b444530 --- /dev/null +++ b/c++/AE00.cpp @@ -0,0 +1,27 @@ +#include +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<