K

 avatar
unknown
c_cpp
a year ago
433 B
10
Indexable
#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {
    int t;
    cin >> t;
    
    vector<int> a;
    int x = 1;
    while (a.size() <= 1000) {
        if (x % 3 != 0 && x % 10 != 3) {
            a.push_back(x);
        }
        x++;
    }
    
    while (t--) {
        int k;
        cin >> k;
        cout << a[k - 1] << endl;
    }
    return 0;    
}

 





Editor is loading...
Leave a Comment