-
Notifications
You must be signed in to change notification settings - Fork 0
/
A_Dislike_of_Threes.cpp
74 lines (67 loc) · 1.35 KB
/
A_Dislike_of_Threes.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <bits/stdc++.h>
#define lim 1000000007
#define rep(i,a,b,step) for(unsigned long long i=a;i<b;i+=step)
#define min(a,b) (a>b)?b:a
#define max(a,b) (a>b)?a:b
#define vecI vector<int>
#define vecB vector<bool>
#define vecL vector<long>
#define vecLL vector<long long>
#define vecUL vector<unsigned long>
#define vecULL vector<unsigned long long>
#define yes "YES"
#define no "NO"
using namespace std;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
template <typename T>
ostream &operator<<(ostream &os, vector<T> arr){
for (T i = 0; i < arr.size(); ++i){
os << arr[i] << " ";
}
return os;
}
void swap(int &a, int &b){
a = a ^ b;
b = a ^ b;
a = a ^ b;
}
vector<ull> fact(1000000,1);
void factorial(){
for (ull i = 2;i<1000000;i++){
fact[i] = i* fact[i-1];
}
}
void reverseString(string &s, ull l,ull h){
while(l<h){
char temp = s[l];
s[l] = s[h];
s[h] = temp;
l++;
h--;
}
}
vecULL vec;
void formingPolycarps(){
for(int i=1;i<10001;i++){
if(i%3==0 || i%10==3) continue;
else vec.push_back(i);
}
}
void solve(){
long k;
cin>>k;
cout<<vec[k-1]<<endl;
}
int main() {
// factorial();
formingPolycarps();
unsigned int T;
cin>>T;
// T=1;
while(T--){
solve();
}
return 0;
}