UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#171354#989. 找素数heyuzhen1000ms1228kbC++359b2023-06-22 21:54:092023-06-22 21:54:11

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool ss(long long n){
	if(n < 2)return 0;
	for(long long i = 2;i * i <= n;i++)
		if(n % i == 0)
			return 0;
	return 1;
}ll n,a,x;
int main(){
	cin >> n;
	for(ll i = 1;i <= n;i++){
		cin >> a;
		if(ss(a))x++;
	}printf("%.2f%%",(x + 0.0) / (n + 0.0) * 100.0);
	return 0;
}


详细

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

Test #1:

score: 33
Accepted
time: 0ms
memory: 1228kb

input:

10
55 57 23 65 14 53 44 12 5 66

output:

30.00%

result:

ok single line: '30.00%'

Test #2:

score: 33
Accepted
time: 0ms
memory: 1228kb

input:

45
43 65 88 90 40 16 37 65 76 54 5 46 13 29 47 42 82 77 62 39 81 34 49 27 96 77 85 53 44 84 38 95 43...

output:

24.44%

result:

ok single line: '24.44%'

Test #3:

score: 33
Accepted
time: 0ms
memory: 1224kb

input:

53
43 65 88 90 40 16 37 65 76 54 5 46 13 29 47 42 82 77 62 39 81 34 49 27 96 77 85 53 44 84 38 95 43...

output:

24.53%

result:

ok single line: '24.53%'