View Code of Problem 31

#include<iostream>
#include<map>
#include<cmath>
using namespace std;
bool judge(int n){
	if((n%3==2)&&(n%5==3)&&(n%7==2)){
		return true;
	}
	return false;
}
int main(){
	int k;
	while(cin>>k){
		
	
	int count=0;
	long long i;
	for(i=1;i<=10100000;i++){
		if(judge(i)){
			count++;
				if(count==k){
					cout<<i<<endl;
				}
		}
}
	}
}

 

Double click to view unformatted code.


Back to problem 31