ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#168211 | #1245. 判断质数 | luojianwei2216 | 100 | 18ms | 1164kb | C++ | 276b | 2023-01-29 20:04:09 | 2023-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'