View Code of Problem 31

#include <iostream>
#include<stdio.h>
#include<math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {


		long long int k ;
		scanf("%lld" , &k);
		//找出第k个被3,5,7除的时候,余数为2,3,2的数——
		int count = 0;
		int num = 9;
		while(k !=EOF && k >= 1) {
			if( num % 3 == 2 && num % 5 ==3 && num % 7 ==2   )
				count++;
			if(count == k) {
				printf("%d" , num);
				break ;
			}
			num++;
		}


	return 0 ;
}












Double click to view unformatted code.


Back to problem 31