题解列表

筛选

筛选N以内的所有素数

摘要:解题思路:枚举每一个数字,判断是否为素数。注意事项:0和1要做特殊判断它们是非素数参考代码:#include<stdio.h>int Is_Prime(int n){    int i;    if(……
优质题解

搭配购买(并查集+01背包)

摘要:#***前置知识*** ### 并查集 并查集是一种数据结构,主要用于处理一些不交集合的合并及查询问题。它支持两种操作: ```cpp 合并两个集合 查询某个元素所在的集合 ``` ……

2857: 加密的病历单

摘要:#include<stdio.h> #include<math.h> #include<string.h> # define N 100001 int check(char c) {……

2855: 简单密码

摘要:#include<stdio.h> #include<math.h> #include<string.h> # define N 100001 int main() {     c……

2854: 密码翻译

摘要:#include<stdio.h> #include<math.h> #include<string.h> # define N 100001 int main() {     c……

完全二叉树的权值最详细注释

摘要:利用树的性质 主要两个点: 1. 最后一层节点可能不是满的,所以需要加上这个判断条件 (i == n-1) 2. 下一层的节点数是上一层的节点数*2,通过判断当前第几个节点是否==该层总结点……

利润计算c++

摘要:解题思路:注意事项:参考代码:#include<iostream>#include<string>using namespace std;int main(){    float i,a; while……

用筛法求之N内的素数

摘要:解题思路:#include <stdio.h>int main(){ int n,i,j,k; scanf("%d",&n); for(i=2;i<=n;i++){ k=0; for(j=2;j<……