这名用户暂未设置签名。
追踪最近的用户名外显变动记录。
最近的文章、讨论、云剪贴板与社区记录
在讨论《求助,样例过了,但全WA》回复:
@[王建琳2021](/user/513670) 大佬您好,恕我愚钝,我还是不太明白您的意思,恳请您看看: 我的思路是swap(&stu[size],&stu[tip]),然后size--(假删除),请问这两句话会导致什么bug吗?
```c #include #include typedef struct{ char name[25]; int score; }Student; void swap(Student*a,Student*b){ char temp[25]; strcpy(temp,a->name); strcpy(a->name,b…
在讨论《0分求助!》回复:
@[lanretE](/user/398190) 木材长度已经存在的时候不需要放进去吧
样例过了,自己造了几组数据测试也都能过,但提交全都WA,已经debug一上午了qwq ```cpp #include #include using namespace std; typedef struct Node { long val; Node* left; Node* right; Node(long _val…
```cpp #include #include using namespace std; typedef struct Node{ char c; bool isEnd; Node*nodePointer[75]; Node(char _c='\0'):c(_c),isEnd(false){ for(int i=0;…
```cpp #include #include using namespace std; int ans=1; void dfs(const string& preOrder,int begin,int end,const string& postOrder,int rbegin,int rend){ if(begi…
“给定一颗以 1 号结点为根的二叉树,请求出其深度、宽度和两个指定节点 x, y 之间的距离”。 因为从子节点到父节点距离记为2,从父到子距离记为1,那么从x到y和从y到x距离明显可能存在不同 然后我理解为最小距离,结果只AC了约一半的点,改成x到y的距离后就AC了
对每一个右括号,找到在它左边最靠近它的左括号匹配,如果没有就放弃: 意思是对每一个右括号,如果它左边那个是左括号:if 这个左括号匹配:pass else:补全这个括号
TLE了 3 4 5点 ```cpp #include using namespace std; struct Node{ long num; Node* next; Node(long _num=0,Node*_next=nullptr):num(_num),next(_next){} }; int main(){…
在讨论《这里只有第一个点对了,有无大佬康康》回复:
@[_cyle_King](/user/582035) 你这组数据不符合题目要求吧?题目说保证查询的柜子有存过东西
中文:流星的力量会将它所在的格子,以及周围 44 个相邻的格子都化为焦土 英文:Each meteor destroys the point that it strikes and also the four rectilinearly adjacent lattice points. 看了题目我一直想不明白为什么一个…
在讨论《只AC了三个点,其他全部TLE》回复:
我知道错在哪里了: 上面的代码思路是把每一种情况都罗列出来,最后判断该种情况是否符合,那么一共有n^n种情况(每一行选一个,一行可选n个,一共可选n行,根据分步乘法计数原理)。这种比阶乘算法复杂度还高(大概在n=9时就TLE了)。 上面的算法叫做暴力,暴力和回溯含义有不同之处,看了讲解视频后用回溯打了出来,分析本题的回…
```cpp #include #include using namespace std; int ans=0; bool check(char **board,int n){ for(int col=0;col 1||tip==0){ return false; } } //平行主对角线 for(int c=-n+1…
在讨论《一直只AC了七个点,求助》回复:
@[Eternal蒟蒻](/user/398190) 求助大佬,改了之后只AC了5个点
```cpp #include #include using namespace std; using namespace std; int check(double mid,long n,long p,long a[],long b[]){ double need=0; for(long i=0;i b[i]){ n…
```cpp #include using namespace std; int mp[10]={0}; int main(){ char n[250]={'a'}; char c; int i; for(i=0;i >k; //not necessary: int count=0;//记录删除了几个数 int j;…
在讨论《样例好像有问题???》回复:
是我错了。(捂脸) Output:3 2 7 8 1 4 9 6 10 5 ‘3’指的是Input中56 12 1 99 1000 234 33 55 99 812中的一(因为1是输入的第三个数据)。 我错误理解成了将数据排序后输出Input中的顺序对应排序后的编号:5 2 1 6 10 8 3 4 7 9 (Inpu…
在讨论《样例好像有问题???》回复:
@[一个pupil](/user/500205) Input 10 56 12 1 99 1000 234 33 55 99 812 那个10 是指人数,后面10 个数才是每个人接水时间
Input: 10 56 12 1 99 1000 234 33 55 99 812 Output: 3 2 7 8 1 4 9 6 10 5 291.90 为什么1000是第一位接水的?那么后面9个人9*1000。 如果1000是最后一位接水的?那么答案里面最多一个1000 再加上其他的数也没有9000这么多啊???…
得到递推公式 f[k]=0; for(int x=0;x<=k-1;x++){ f[k]+=(f[k-x]+1); } 推导过程如下:假设有k个元素要进栈,这k个数的前面k-1个数已经进栈了一次(先不管有没有弹出来),那么当第k个元素(就是最后一个元素)要进栈时: (初始化设f[k]=0) 一、若栈里面有k-1个元素,…
有哪位大佬有空吗,能看看这段代码时间复杂度是多少? ```cpp #include using namespace std; int ans=0; void sort(int a[],int begin,int end){ if(begin>=end){ return; } int x=begin,y=end; int…
```cpp #include using namespace std; int main(){ int ans=0; int num[10]={6,2,5,5,4,5,6,3,7,6}; int n; cin>>n;//最高每一位20/2=10根,(不是20/3),最高11111 //暴力枚举法判断数据范围很重要 f…
```cpp #include using namespace std; int main(){ int R,C,K; cin>>R>>C>>K; char playground[R][C]; for(int i=0;i >playground[i][j]; } } int count=0; for(int i=0;i…
```cpp #include using namespace std; class Writing { public: Writing() { cout<<"Writing constructor"<<endl; } ~Writing(){ cout<<"~Writing"<<endl; } }; class Rac…
以下斜体内容转载自洛谷题解 题目P1518 [USACO2.4]两只塔姆沃斯牛 The Tamworth Two _**3.判断是否可以相遇 怎么判断呢?我们可以想到,如果两个物体先后两次从同一个方向走到同一个地点,我们就可以说它们陷入了死循环,但如何判断是否是死循环??这是一个难倒众人的问题。 我们可以通过生成专属值…
```cpp #include #include #include #include using namespace std; double a,b,c,d; double equation(double x){ return a*x*x*x+b*x*x+c*x+d; } int main(){ cin>>a>>b>>…