View Code of Problem 31

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(){

	/*
		找出第k个被3,5,7除的时候,余数为2,3,2的数——算法导论
		有多组测试样例,输入直到文件末尾。
		每组样例输入一个数k(k1)。
	*/
	int n;
	while(  scanf("%d" , &n ) != EOF  ){
		if( n == 1)
			printf("23\n");
		else
			printf("%lld\n" , ( n - 1 ) *105 + 23 );
	}
	
	

	return 0;
}	

Double click to view unformatted code.


Back to problem 31