View Code of Problem 31

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int i = 23;
		while(i){
			if(i%3==2&&i%5==3&&i%7==2){
				n--;
				if(n==0){cout<<i<<endl; break;}
			}
			i++;
		}
	}
	
	
	
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 31