上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 85 下一页
摘要: 水题 设d为进位,每次两个对应位相加并加上d = tmp 新数字当前位 = tmp % 10 d = tmp / 10 注意nullptr /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNo 阅读全文
posted @ 2022-02-27 21:04 WTSRUVF 阅读(34) 评论(0) 推荐(0)
摘要: boost::filesystem::is_directory (dir_) //判断dir_是否为目录 boost::filesystem::directory_iterator itr(dir_) //迭代器,结合for循环遍历dir_内的所有内容 无参数的directory_iterator( 阅读全文
posted @ 2022-02-26 20:58 WTSRUVF 阅读(375) 评论(0) 推荐(0)
摘要: 读写模式 r : 读取文件,若文件不存在则会报错 w: 写入文件,若文件不存在则会先创建再写入,会覆盖原文件 a : 写入文件,若文件不存在则会先创建再写入,但不会覆盖原文件,而是追加在文件末尾 rb,wb: 分别与r,w类似,但是用于读写二进制文件 r+ : 可读、可写,文件不存在也会报错,写操作 阅读全文
posted @ 2022-02-11 11:10 WTSRUVF 阅读(308) 评论(0) 推荐(0)
摘要: 画点 from PIL import Image from pylab import * import cv2 import matplotlib.pyplot as plt im = array(Image.open('E:/1.jpg')) # im.astype(int) plt.imshow 阅读全文
posted @ 2022-02-09 20:04 WTSRUVF 阅读(115) 评论(0) 推荐(0)
摘要: 用循环 暴力即可 class Solution { public: string tictactoe(vector<string>& board) { int n = board.size(); int flag1 = 0, flag2 = 0, flag3 = 1; for(int i = 0; 阅读全文
posted @ 2022-02-09 09:23 WTSRUVF 阅读(31) 评论(0) 推荐(0)
摘要: 优先选 截止时间靠后的且持续时间短的 class Solution { public: int scheduleCourse(vector<vector<int>>& courses) { int len = courses.size(); int ret = 0, cnt = 0; priorit 阅读全文
posted @ 2022-01-28 11:31 WTSRUVF 阅读(22) 评论(0) 推荐(0)
摘要: 水题 class Solution { public: string addSpaces(string s, vector<int>& spaces) { int len = s.length(); string ret = ""; int i = 0, j = 0; while(i < len) 阅读全文
posted @ 2022-01-27 09:50 WTSRUVF 阅读(57) 评论(0) 推荐(0)
摘要: 每个平滑下降的阶段为一个段,先计算有几个段以及每个段有几个数 如果段中有1个数,则ret += 1 否则 ret += 段的长度 (段中每个数单独一个段),然后ret += 这个段中任意长度的相邻数段的数量 (这个就等于C(2,m),其中m为段的长度) class Solution { public 阅读全文
posted @ 2022-01-22 11:20 WTSRUVF 阅读(40) 评论(0) 推荐(0)
摘要: 先找边界:SG[0] = 0表示当石子数为0时,先手输 然后套SG即可 若为n堆,每堆的SG异或即可 class Solution { public: int SG[100001]; int vis[100]; bool winnerSquareGame(int n) { SG[0] = 0; fo 阅读全文
posted @ 2022-01-21 11:54 WTSRUVF 阅读(53) 评论(0) 推荐(0)
摘要: 两个idea: 1、霍夫变换找圆在复杂环境并不理想,可以找轮廓,然后限制外接矩形w和h来排除 2、坐标排序时,可能同一行的x有些许误差,则可以这样排序(分两次排序):假设一行5个, 先从上向下排序,则每5个即为一道题的选项,虽然是乱序的,但只要再对每5个从左向右排序即可 主要判断论述: import 阅读全文
posted @ 2022-01-20 12:16 WTSRUVF 阅读(233) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 85 下一页