他**的,样例没过,求救
查看原帖
他**的,样例没过,求救
644394
dongrq_cs楼主2023/5/20 17:56
#include <bits/stdc++.h>
using namespace std;
int w[1005],n,k,ans = 0,s = 0;
bool zhishu(int n){
	if(n < 2){
		return false;
	}
	for(int i = 2;i <= n - 1;i++){	
		if(n % i == 0){
			return false;
		}
	}
	return true;
}
int main(){
	cin >> n >> k;
	for(int i = 2;i <= n;i++){
		if(zhishu(i) == true){
			s++;
			w[s] = i;
		}
	}
	for(int i = 1;i <= s;i++){
		for(int j = 1;j < i - 1;j++){
			if(w[i] + w[j + 1] + 1 == w[i]){
				ans++;
			}
		}
	}
	if(ans >= k){
		cout << "YES";
	}else{
		cout << "NO";
	}
	return 0;
}
2023/5/20 17:56
加载中...