string str;//文件路径int pos=str.find_last_of("/"); str=str.substr(0,pos); vector<string > filenames;while(_access(str.c_str(),0) 1){ pos=str.find_last_of ...
分类:
编程语言 时间:
2020-07-13 13:54:40
阅读次数:
94
等差数列 2,5,8,11,14。。。。 while True: line = input().strip() if not line: break line2 = int(line) num = 2 sumnum = 0 while line2 > 0: sumnum = num + sumnum ...
分类:
其他好文 时间:
2020-07-13 13:38:55
阅读次数:
53
题目描述 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向 ...
分类:
编程语言 时间:
2020-07-13 12:00:44
阅读次数:
177
题目描述 题解 必须要发掘出性质才能搞,乱找找不满 一草稿纸的114514越看越草 发现5只出现一次,而且14是114的子串 显然可以想到每次按最近的来匹配,一次找出一个114514 发现114511451414会挂掉,原因是把第二个5的114给拆掉了 1的数量最多,所以只考虑总量不考虑单独每个 对 ...
分类:
其他好文 时间:
2020-07-13 11:15:32
阅读次数:
64
曲名:Little Poor Me 作者:Layto 1 [00:01.19]I tried hard, you know I care 2 [00:05.01]I care, I care 3 [00:09.22]Just a little poor me 4 [00:13.64]Just a l ...
分类:
其他好文 时间:
2020-07-13 09:52:15
阅读次数:
113
用途 getopt_long()用于解析类似于 --version --config configfile 这样的长选项。 如何使用 1、定义struct option数组 struct option { cosnt char* name; //长选项的名称。 比如 ./xx --config de ...
分类:
其他好文 时间:
2020-07-13 09:43:18
阅读次数:
80
1 C语言代码 1 #include <stdio.h> 2 #include <unistd.h> 3 4 int main() 5 { 6 if(!fork()){while(1)printf(“A”);} 7 if(!fork()){while(1)printf(“B”);} 8 wait() ...
分类:
其他好文 时间:
2020-07-12 22:36:25
阅读次数:
81
class Solution { vector<vector<pair<int,double> > >v; public: double maxProbability(int n, vector<vector<int>>& edges, vector<double>& succProb, int s ...
分类:
其他好文 时间:
2020-07-12 22:32:44
阅读次数:
79
资源限制 时间限制:1.0s 内存限制:256.0MB 问题描述 小张是软件项目经理,他带领3个开发组。工期紧,今天都在加班呢。为鼓舞士气,小张打算给每个组发一袋核桃(据传言能补脑)。他的要求是: 1. 各组的核桃数量必须相同 2. 各组内必须能平分核桃(当然是不能打碎的) 3. 尽量提供满足1,2 ...
分类:
其他好文 时间:
2020-07-12 22:16:24
阅读次数:
60
双指针算法 LeetCode 3. 无重复字符的最长子串 while()是非法的,在外更新答案 class Solution { public int lengthOfLongestSubstring(String s) { char[] c = s.toCharArray(); int n = c ...
分类:
编程语言 时间:
2020-07-12 22:13:42
阅读次数:
73