-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path156. CUBEFR.cpp
60 lines (51 loc) · 1.13 KB
/
156. CUBEFR.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<bits/stdc++.h>
using namespace std;
//defined my macro functions
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//defined my macro strings
#define ENDL "\n"
#define SPACE " "
//defined my constants
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 3.14159265358979323846;
//defined my own datatypes
typedef long long ll;
typedef unsigned long long ull;
vector<bool> oui(101 * 101 * 101, true);
vector<int> pos(101 * 101 * 101);
void precalc(int n)
{
for(int i = 2; i <= n; i++)
{
int mul = 1;
int cube = i * i * i;
while(cube * mul < 1000010) oui[cube * (mul++)] = false;
}
int counter = 0;
for(int i = 1; i < 1000010; i++)
{
if(oui[i]) counter++;
pos[i] = counter;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
precalc(101);
int t;
cin>>t;
int total = t;
while(t--)
{
int n;
cin>>n;
cout<<"Case "<<total - t<<": ";
if(oui[n]) cout<<pos[n]<<endl;
else cout<<"Not Cube Free"<<endl;
}
return 0;
}