UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#168211#1245. 判断质数luojianwei221610018ms1164kbC++276b2023-01-29 20:04:092023-01-29 20:04:10

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
	long long n;
	cin >> n;
	if(n <= 1) {
		cout << "FALSE";
		return 0;
	}
	for(int i = 2; i <= sqrt(n); i++) {
		if(n % i == 0) {
			cout << "FALSE";
			return 0;
		}
	}
	cout << "TRUE";
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

11

output:

TRUE

result:

ok single line: 'TRUE'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1156kb

input:

364

output:

FALSE

result:

ok single line: 'FALSE'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

12

output:

FALSE

result:

ok single line: 'FALSE'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

0

output:

FALSE

result:

ok single line: 'FALSE'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

1

output:

FALSE

result:

ok single line: 'FALSE'

Test #6:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

2

output:

TRUE

result:

ok single line: 'TRUE'

Test #7:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

3

output:

TRUE

result:

ok single line: 'TRUE'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1160kb

input:

121

output:

FALSE

result:

ok single line: 'FALSE'

Test #9:

score: 10
Accepted
time: 18ms
memory: 1164kb

input:

1000000000000000007

output:

FALSE

result:

ok single line: 'FALSE'

Test #10:

score: 10
Accepted
time: 0ms
memory: 1164kb

input:

100000000000000007

output:

FALSE

result:

ok single line: 'FALSE'