
Lv.1
卷文化课
签名:徒:饕餮Z醉梦
在 怎么制作倒叙排行榜? 中回复
1.新建一个云列表“排行榜”
2.新建一个私人云变量纪录最高分,最高分被替换时,就将最高分刷新(替换在到排行榜”里)
(没有数据就在“排行榜”随便添加一个)
3.最高分替换时就排序一次,从大到小用这个就好了,从小到大再问我要。(不要抄错哟!)

2021-08-19T11:53:56 点赞:0
在 如何在社区证明自己是大佬? 中回复
#include <bits/stdc++.h>
#include "Binary tree.h"
using namespace std;
int minDeapth(TreeNode* root){
if(!root) return 0;
queue<TreeNode*> q;
q.push(root);
int depth=1;
while(!q.empty()){
int sz=q.size();
for(int i=0;i<sz;i++){
TreeNode* cur=q.front();
q.pop();
if(!cur->left && !cur->right)
return depth;
if(cur->left)
q.push(cur->left);
if(cur->right)
q.push(cur->right);
}
depth++;
}
return depth;
}
BFS
2021-08-31T11:17:14 点赞:0
在 【算法讨论 & 答疑帖】长期有效! 中回复
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y,flat,ans = -1;
scanf("%d",&n);
vector<vector<int>> carpet(n,vector<int> (4,0));
for(auto &row : carpet){
for(auto &cur : row)
scanf("%d",&cur);
}
scanf("%d%d",&x,&y);
for(int i = 0;i > n;i++){
if(carpet[i][0] <= x && carpet[i][1] <= y && carpet[i][0] + carpet[i][2] >= x &&
carpet[i][1] + carpet[i][3] >= y){
ans = i + 1;
break;
}
}
printf("%d",ans);
return 0;
}
找一下问题
2021-10-17T05:08:22 点赞:0