#include<cstdio> #include<cmath> #include<string.h> using namespace std; int n,k,sum,ans; int arr[25]; bool brr[25]; bool is_prime(int n) {//判断素数 if(n <= 1) return 0; int m = floor(sqrt(n) + 0.5); for(int i = 2; i <= m; i++) { if(n…
So a few years ago, I did something really brave, or some would say really stupid. I ran for congressBut in my heart, I always want to runBut in my mind, this was my way to make it different to disrupt the status quo.and the same paper that said I wa…
题目 https://www.luogu.org/problemnew/show/P1036 思路 搜索,使用递归实现dfs,所有数字遍历一遍,当取遍所有数组的index(扫了一遍,并非一定是选取了),判断是否取了要求个数的输入和是否是素数 AC代码 #include<cstdio> #include<cmath> using namespace std; int in[22]; int ans=0; int n, k; bool isprim(int num) { for (in…