摘要:指针错误情况: 1、空指针 指向不可访问的地址: { int *p; *p = 1; } 2、野指针 指向未分配空间的地址: { int *p; p = NULL; *p = 1; } 指向未知的特定地址 { char *p = 0x00123456; *p = 1; } 3、悬空指针 使用了已经f
阅读全文
摘要:输入年,输出一整年的日历 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<math.h> int Year_return, Month_return, Days_return; //date_after_days()的传出参数
阅读全文
摘要:请根据每日 气温 列表,重新生成一个列表。对应位置的输出为:要想观测到更高的气温,至少需要等待的天数。如果气温在这之后都不会升高,请在该位置用 0 来代替。 例如,给定一个列表 temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是 [1, 1
阅读全文
摘要:#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <string> using namespace std; class Solution { public: string rem
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> using namespace std; /*原理:双指针法 先将数组排序! 设定一个 p ,然后设定左指针 L = p + 1 ,右指针 R = size - 1 ; 要逼近的数是
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> using namespace std; //原理:动态规划法 //到达每个阶梯都有一个理论上的最小体力minCost,按照minCost[i] = min(minCost[i-2]
阅读全文
摘要:1 #include <iostream> 2 #include <vector> 3 #include <string> 4 #include <queue> 5 #include <stack> 6 #include <algorithm> 7 using namespace std; 8 9
阅读全文