View Code of Problem 31

#include<iostream>
using namespace std;
int main() {
	long long k;
	while(cin>>k) {
		long long count=0, j=9, i=1; 
		while(1) {
			if(j%3==2&&j%5==3) {
				count++;
				if(count==k) break;
			}
			i++;
			j=7*i+2;
		}
		cout<<j<<endl;
	}
} 

Double click to view unformatted code.


Back to problem 31