编写题解 2945: 素数对
摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h> using namespace std;int s(int n){ if(n==1) return 0; for(int ……
2945: 素数对(C++题解)
摘要:###定义一个bool型函数isPrime,接下来for循环即可
# 上代码!
```cpp
//School//
#include
#include//调用sqrt函数需要写数学库头文件c……
2945: 素数对(简单解)
摘要:AC代码
代码解析:
is_prime函数:该函数用来判断一个数字是否为素数。如果数字小于2,直接返回false。然后从2开始,依次遍历到sqrt(num),如果存在某个数能整除num,则返回……