![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
代码
吃不起饭的小陈
这个作者很懒,什么都没留下…
展开
-
LeetCode-66-加一
66 加一题目: 给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。你可以假设除了整数 0 之外,这个整数不会以零开头。示例1:输入:digits = [1,2,3]输出:[1,2,4]解释:输入数组表示数字 123。示例2:输入:digits = [4,3,2,1]输出:[4,3,2,2]解释:输入数组表示数字 4321。示例3:输入:digits = [0]输出:[1]提示: - 1原创 2022-03-22 17:33:51 · 324 阅读 · 0 评论 -
LeetCode-2038-如果相邻两个颜色均相同则删除当前颜色
2038 如果相邻两个颜色均相同则删除当前颜色题目: 总共有 n 个颜色片段排成一列,每个颜色片段要么是 'A' 要么是 'B' 。给你一个长度为 n 的字符串 colors ,其中 colors[i] 表示第 i 个颜色片段的颜色。Alice 和 Bob 在玩一个游戏,他们 轮流 从这个字符串中删除颜色。Alice 先手 。如果一个颜色片段为 'A' 且 相邻两个颜色 都是颜色 'A' ,那么 Alice 可以删除该颜色片段。Alice 不可以 删除任何颜色 ‘B’ 片段。如果一个颜色片段为 ‘原创 2022-03-22 16:21:26 · 116 阅读 · 0 评论 -
LeetCode-021-合并两个有序链表
021 合并两个有序链表题目: 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。示例1:输入:l1 = [1,2,4], l2 = [1,3,4]输出:[1,1,2,3,4,4]示例2:输入:l1 = [], l2 = []输出:[]示例3:输入:l1 = [], l2 = [0]输出:[0]提示: - 两个链表的节点数目范围是[0, 50] - -100 <= Node.val <= 100 - l1 和 l2原创 2022-01-18 22:14:35 · 148 阅读 · 0 评论 -
LeetCode-20-有效的括号
20 有效的括号题目: 给定一个只包括 ‘(’,’)’,’{’,’}’,’[’,’]’ 的字符串 s ,判断字符串是否有效。有效字符串需满足:左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。示例1:输入:s = "()"输出:true示例2:输入:s = "()[]{}"输出:true示例3:输入:s = "(]"输出:false示例4:输入:s = "([)]"输出:false示例5:输入:s = "{[]}"输出:true提示: -原创 2022-01-18 21:36:04 · 4423 阅读 · 0 评论 -
LeetCode-593-最小时间差
593 最小时间差题目: 给定一个 24 小时制(小时:分钟 “HH:MM”)的时间列表,找出列表中任意两个时间的最小时间差并以分钟数表示。示例1:输入:timePoints = ["23:59","00:00"]输出:1示例2:输入:timePoints = ["00:00","23:59","00:00"]输出:0提示: - 2 <= timePoints <= 2 * 10^4 - timePoints[i] 格式为 "HH:MM"答案:class Solut原创 2022-01-18 16:05:22 · 4345 阅读 · 0 评论 -
LeetCode-009-回文数
009 回文数题目: 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。示例1:输入:x = 121输出:true示例2:输入:x = -121输出:false解释:从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。示例3:输入:x = 10输出:false解释:从右向左读, 为 01 。因此它不是一个回原创 2022-01-17 22:37:48 · 3606 阅读 · 0 评论 -
LeetCode-382-链表随机节点
382 链表随机节点题目: 给你一个单链表,随机选择链表的一个节点,并返回相应的节点值。每个节点被选中的概率一样。实现 Solution 类:Solution(ListNode head) 使用整数数组初始化对象。int getRandom() 从链表中随机选择一个节点并返回该节点的值。链表中所有节点被选中的概率相等。示例:输入["Solution", "getRandom", "getRandom", "getRandom", "getRandom", "getRandom"][[[1,原创 2022-01-16 16:32:13 · 80 阅读 · 0 评论 -
LeetCode-373-查找和最小的K对数字
373 查找和最小的K对数字题目: 给定两个以 升序排列 的整数数组 nums1 和 nums2 , 以及一个整数 k 。定义一对值 (u,v),其中第一个元素来自 nums1,第二个元素来自 nums2 。请找到和最小的 k 个数对 (u1,v1), (u2,v2) ... (uk,vk) 。示例1:输入: nums1 = [1,7,11], nums2 = [2,4,6], k = 3输出: [1,2],[1,4],[1,6]解释: 返回序列中的前 3 对数:[1,2],[1,4],[1,原创 2022-01-15 19:24:39 · 298 阅读 · 0 评论 -
LeetCode-1716-计算力扣银行的钱
1716 计算力扣银行的钱题目: Hercy 想要为购买第一辆车存钱。他每天都往力扣银行里存钱。最开始,他在周一的时候存入 1 块钱。从周二到周日,他每天都比前一天多存入 1 块钱。在接下来每一个周一,他都会比前一个周一多存入 1 块钱。给你 n ,请你返回在第 n 天结束的时候他在力扣银行总共存了多少块钱。示例1:输入:n = 4输出:10解释:第 4 天后,总额为 1 + 2 + 3 + 4 = 10 。示例2:输入:n = 10输出:37解释:第 10 天后,总额为 (1 +原创 2022-01-15 19:08:09 · 100 阅读 · 0 评论 -
LeetCode-003-无重复字符的最长子串
003 无重复字符的最长子串题目: 给定一个字符串 s,请你找出其中不含有重复字符的最长子串的长度。示例1:输入: s = "abcabcbb"输出: 3 解释: 因为无重复字符的最长子串是"abc",所以其长度为3。示例2:输入: s = "bbbbb"输出: 1解释: 因为无重复字符的最长子串是"b",所以其长度为1。示例3:输入: s = "pwwkew"输出: 3解释: 因为无重复字符的最长子串是 "wke",所以其长度为3。请注意,你的答案必须是子串的长度,"pwke原创 2022-01-14 16:06:22 · 105 阅读 · 0 评论 -
LeetCode-747-至少是其他数字两倍的最大数
747 至少是其他数字两倍的最大数题目: 给你一个整数数组 nums ,其中总是存在 唯一的 一个最大整数 。请你找出数组中的最大元素并检查它是否 至少是数组中每个其他数字的两倍 。如果是,则返回 最大元素的下标 ,否则返回 -1 。示例1:输入:nums = [3,6,1,0]输出:1解释:6 是最大的整数,对于数组中的其他整数,6 大于数组中其他元素的两倍。6 的下标是 1 ,所以返回 1。示例2:输入:nums = [1,2,3,4]输出:-1解释:4 没有超过 3 的两倍大,所原创 2022-01-13 16:19:33 · 96 阅读 · 0 评论 -
LeetCode-002-两数相加
002 两数相加题目: 给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。请你将两个数相加,并以相同形式返回一个表示和的链表。你可以假设除了数字 0 之外,这两个数都不会以 0 开头。示例1:输入:l1 = [2,4,3], l2 = [5,6,4]输出:[7,0,8]解释:342 + 465 = 807.示例2:输入:l1 = [0], l2 = [0]输出:[0]示例3:输入:l1 = [9,9,9,9,原创 2022-01-13 11:34:36 · 63 阅读 · 0 评论 -
LeetCode-001-两数之和
001 两数之和题目: 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。你可以按任意顺序返回答案。示例1:输入:nums = [2,7,11,15], target = 9输出:[0,1]解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1]。示例2:输入:nums = [3,2,4],原创 2022-01-11 22:32:22 · 600 阅读 · 0 评论 -
MFC Windows 程序设计实验 --- Edit Boxes
1 实验描述:create edit boxes and realize the operation like addition, subtraction, multiplication and division.2 同上一篇文章,新建一个项目工程。3 同上一篇文章,向资源文件 Diglog 中添加题目要求的控件。4 同上一篇文章,为类成员添加类型。5 同上一篇文章,为每个控件添加函数。如下图,为实现Addition功能的函数:6 结果如下图:...原创 2020-05-14 14:47:30 · 201 阅读 · 0 评论 -
MFC Windows 程序设计实验--- Computation of score based on the score and the weight
1 实验描述:Design a program by using MFC AppWizard to realize the computation of score based on the score and the weight.2 创建MFC工程项目(VC++6.0):选择 MFC AppWizard(exe) --> 填入工程名称 --> 点击“确定” --> 选择“基本对话框” --> 点击“完成”创建成功后,资源文件包括以下几部分:2 向资源文件 Diglog原创 2020-05-14 11:34:20 · 234 阅读 · 0 评论 -
MFC Windows 程序设计---Hello MFC!
1 源代码如下 :HelloMFC.h原创 2020-05-07 11:31:16 · 378 阅读 · 0 评论 -
Windows程序设计实验---Windows API Programming 2
实验描述:1 . Create a menu which includes three menu items: File, Calculate andHelp.1.2 When the Draw(G) menu item of the File(F) menu is clicked, thefigure is drawn as shown below.1.3 And when t...原创 2020-04-23 11:30:00 · 252 阅读 · 0 评论 -
Windows程序设计实验---Design a menu drawing Circle and Rectangle
实验描述:When select DRAW CIRCLR/DRAW RANCTANGLE and then press the right/left/up/down arrow on the keyboard, the size of the CIRCLE/RANCTANGLE will change accordingly. (选择画圆或画矩形,然后点击键盘上的 ↑ ↓ ← →改变其...原创 2020-04-16 11:15:08 · 390 阅读 · 2 评论 -
Windows程序设计实验---BOUNCING BALL
实验描述:Design a program to realize the bouncing ball.源代码如下:#include <windows.h>#define ID_TIMER 1 LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInst...原创 2020-04-14 00:50:01 · 325 阅读 · 1 评论 -
Windows程序设计实验---BITMAP
实验描述:Design a program to realize the application of bitmap resource.Load a bitmap (you can use can bitmap download from the Internet) to the center of the window and the size of the bitmap should b...原创 2020-04-13 00:37:56 · 332 阅读 · 0 评论 -
Windows程序设计实验---Menu and Dialog
实验描述:Design a program to realize the application of menu and dialog box.源代码如下:#include <windows.h>#define IDE_SHOW 301#define IDE_HIDE 302#define IDE_EXIT 303HMENU hMenu =CreateMenu();...原创 2020-04-12 23:19:14 · 115 阅读 · 0 评论 -
Windows程序设计第五版源代码---MENUDEMO
源代码如下:.c 文件如下:#include <windows.h>#include "resource.h"#define ID_TIMER 1LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);TCHAR szAppName[] = TEXT ("MenuDemo");int WINAPI WinMain(H...原创 2020-04-09 22:39:02 · 374 阅读 · 0 评论 -
Windows程序设计第五版源代码---CLOCK
源代码如下:#include <windows.h>#include <math.h> #define ID_TIMER 1#define TWOPI (2 * 3.14159) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInsta...原创 2020-04-08 11:51:21 · 330 阅读 · 0 评论 -
Windows程序设计第五版源代码---BEEPER2
源代码如下:#include <windows.h>#define ID_TIMER 1 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);VOID CALLBACK TimerProc(HWND, UINT, UINT, DWORD);int WINAPI WinMain(HINSTANCE hInstance...原创 2020-04-08 00:25:38 · 181 阅读 · 0 评论 -
Windows程序设计第五版源代码---BEEPER1
源代码如下:#include <windows.h>#define ID_TIMER 1 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdSh...原创 2020-04-08 00:15:09 · 167 阅读 · 0 评论 -
Windows程序设计第五版源代码---BTNLOOK
源代码如下:#include <windows.h>struct{ int iStyle; TCHAR * szText;}button[] = { BS_PUSHBUTTON, TEXT("PUSHBUTTON"), BS_DEFPUSHBUTTON, TEXT("DEFPUSHBUTTON"), B...原创 2020-04-05 21:46:41 · 285 阅读 · 1 评论 -
Windows程序设计第五版源代码---CONNECT
源代码如下:#include <windows.h>#define MAXPOINTS 1000LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);RECT rect; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR sz...原创 2020-04-05 19:00:56 · 188 阅读 · 0 评论 -
Windows程序设计第五版源代码---LINEDEMO
源代码如下:#include <windows.h>LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int nCmdShow){ static T...原创 2020-04-05 17:56:53 · 336 阅读 · 0 评论 -
Windows程序设计第五版源代码---ALTWIND
源代码如下:#include<windows.h>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static T...原创 2020-04-04 19:19:32 · 760 阅读 · 0 评论 -
Windows程序设计第五版源代码---SINEVAVE
源代码如下:#include<windows.h>#include<math.h>#define NUM 1000#define TWOPI (2 * 3.14159) LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInsta...原创 2020-04-04 18:34:55 · 303 阅读 · 0 评论 -
Windows程序设计实验---Windows API Programming 1
实验描述:1)To create windowand message loop and write win procedure by calling API functions.1.2To draw andrealize text output in the client area by calling API functions and to understandthe GDI of...原创 2020-04-03 23:04:29 · 290 阅读 · 0 评论 -
Windows程序设计第五版源代码---KEYVIEW1
源代码如下:#include <windows.h>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static T...原创 2020-04-03 14:36:06 · 279 阅读 · 0 评论 -
Windows程序设计第五版源代码---TYPER
源代码如下:#include <windows.h>#define BUFFER(x, y) *(pBuffer + y * cxBuffer + x)LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIns...原创 2020-04-01 20:18:08 · 318 阅读 · 0 评论 -
Windows程序设计实验---KeyBoard
实验描述:Design a program to realize the application of keyboard.When the Ctrl key is held on, ellipse will be drawn; When the Shift key is held on, rectangle will be drawn. (按下Ctrl键- - -画圆,按下Shift键- ...原创 2020-04-01 19:11:45 · 259 阅读 · 0 评论