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
code
Permute
c++ car racing game
19 მარტს დამუშავებული
Dar
Find the Duplicate Number in array of n+1 integers having elements from 1 to n
ProPriceTemp
pure virtual function with non-fixed number of parameters
count common elements in three sorted array without using extraspace
32bit