View Code of Problem 31

#include <iostream>

using namespace std;

int main() {
    int n = 0;
    while((n % 3 != 2 || n % 5 != 3 || n % 7 != 2)) {
        n++;
    }


    long long k;
    while (cin >> k) {
        cout << n + (k - 1) * 3 * 5 * 7 << endl;
    }
}

Double click to view unformatted code.


Back to problem 31