-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcdva1702.cpp
More file actions
42 lines (36 loc) · 711 Bytes
/
cdva1702.cpp
File metadata and controls
42 lines (36 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
#define MAX 1000000
#define DEBUG(x) do { std::cout << #x << ": " << x << " "; } while (0)
using namespace std;
void pre(int *a, int *b, int n){
int i,j,temp,x;
for(i=2;i<n;++i){
a[i]=i+1;
b[i]=1;
}
temp=sqrt(n);
for(i=2;i<=temp;++i){
j=2;
x=pow(i,j);
while(x<n){
a[x]+=i+j;
b[x]++;
++j;
x=pow(i,j);
}
}
}
int main(){
long long int t,x,n,count,temp;
int a[MAX]={0};
int num[MAX]={0};
cin>>t;
//t=1;
pre(a,num,MAX);
while(t--)
{
cin>>n;
cout<<num[n]<<"\n"<<a[n]<<"\n";
}
return 0;
}