Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bc
#include<bits/stdc++.h> using namespace std; #define mem(A) memset(A,0,sizeof(A)) #define loop(i,a,n) for(i=a;i<n;i++) #define pb push_back #define mkp make_pair typedef long long ll; ll func(ll x) { ll c=0,j,flag=0,ans=1; loop(j,2,sqrt(x)+1) { c=0;flag=0; while(x%j==0) { flag=1; x=x/j; c++; } if(flag) ans*=pow(j,c-1)*((j-1)*c+j); } if(x!=0) {j=x; ans*=(pow(j-1,1)+j); } return ans; } int main() { //freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); ll n,i,A[10],B[10]; cin>>n; loop(i,0,n) { cin>>A[i]; } loop(i,1,500005) { B[i]=func(i); } /*cin>>q; while(q--) { cin>>c>>a>>b; }*/ loop(i,0,500005) { C[i+1]+=B[i]; x=i+1; x=x+(x&-x); while(i<=n) { C[x]+=B[i]; x=x+(x&-x); } } }
run
|
edit
|
history
|
help
0
Matrix
count pairs with given sum hashing
Procesos estocasticos Beta 2.0
C++ Car Racing game framework
Sangharsh.vhawale
QuickDoubly
remove dublicates from string using recursion
Palindromo
Pairs having sum equal to target
Building squares using smallest amount of matches