SHARE
TWEET

Untitled

a guest Nov 7th, 2018 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int n;
  5.  
  6. void add(vector<int>&v1, vector<int>&v2){
  7.     for(int i=0; i<n+1; i++)
  8.         v1[i]+=v2[i];
  9. }
  10.  
  11. int main()
  12. {
  13.    cin>>n;
  14.     vector< vector<int> > v(n+1, vector<int>(n+1, 0));
  15.  
  16.     for(int i=2; i<=n; i++){
  17.         if (v[i]==vector<int>(n+1,0))
  18.             v[i][i]=1;
  19.         for(int j=2; j*i<=n; j++){
  20.             v[j*i]=v[i];
  21.             add(v[j*i], v[j]);
  22.         }
  23.     }
  24.  
  25.     for(int i=1; i<n+1; i++)
  26.         add(v[0], v[i]);
  27.  
  28.     int ans=1;
  29.     for(int i=0; i<n+1; i++)
  30.         ans*=v[0][i]+1;
  31.     cout<<ans;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top