/ CYOJ /

记录详情

Accepted

foo.cc: In function 'int main()':
foo.cc:15:27: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   15 |         for(int i = 1 ; i <= n ; i++) {
      |                         ~~^~~~
Found 2 testcases.
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Accepted 2ms 256.0 KiB
#2 Accepted 1ms 256.0 KiB

代码

#include <bits/stdc++.h>
using namespace std;
bool is(unsigned long long int n) {
	if(n == 0 || n == 1)return 0;
	for(int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {
			return 0;
		}
	}
	return 1;
}
int main() {
	unsigned long long int n , x;
	cin >> n;
	for(int i = 1 ; i <= n ; i++) {
		cin >> x;
		if(is(x) == 0)cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}

信息

递交者
类型
递交
题目
P1002 判断质数
语言
C++
递交时间
2022-08-24 15:48:59
评测时间
2022-08-24 15:49:09
评测机
分数
100
总耗时
3ms
峰值内存
256.0 KiB