Submission #3639

# Submission time Handle Problem Language Result Execution time Memory
3639 2013-08-31T07:13:26 Z waps12b Great Pow! (kriii1_G) C++
0 / 1
0 ms 1088 KB
#include<cstdio>


int main() {
	int a, k;
	scanf("%d%d", &a, &k);
	int b = a+1;
	bool chk = 0;
	for(int i = 2 ; i*i <= b ; i++) {
		if( b%i == 0 ) {
			chk = 1;
			break;
		}
	}
	if( k == 0 ) {
		printf("%d\n", a);
		return 0;
	}

	if(chk) { //소수가 아니다
		printf("%d\n", a);
	}
	else printf("%d\n", 1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Incorrect 0 ms 1088 KB Output isn't correct
7 Halted 0 ms 0 KB -