题解列表

筛选

BFS模版题(很模版)

```cpp#includeusingnamespacestd;typedefpairPII;constintN=1000;intn,end_day;charroom[N][N];queueq1;queueq2;intans;intX[]={0,

BFS最短路+超简单思路+清晰代码

摘要:解题思路:求最优路径一般考虑bfs,直接使用队列。队列中元素使用pair,因为还需要记录步数。就是简单入队出队的遍历。注意事项:参考代码:#include <bits/stdc++.h> using……

编写题解 2817: 级数求和

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int main(){int k,i=1;double s=0;cin>>k;whi……

线段树变式+维护区间前8大的值

解题思路:线段树是很常见的数据结构,不会的同学可以自行百度学习。首先题意有两种操作,一个是修改值,一个是查询区间[a,b]的第8大的值。我们使用线段树结构,每个节点存储这个区间的前八位的值,这里不用建树,大家都是0。关键就是怎么让孩子节点的值传递到父节点,

编写题解 2828: 与7无关的数

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;bool bsq(int n) { for(int i=1;i<=n;i++) { ……

编写题解 2820: 含k个3的数

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int jgs(int n) { int j=0;while(n){if(n%10=……

题解 2042: 杨辉三角

摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll N =1e3;ll a……