K

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
433 B
8
Indexable
Never
#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;    
}

 





Leave a Comment