试题地址:https://leetcode-cn.com/problems/reverse-words-in-a-string/ 试题思路: go自带strings.Fields()函数,可以剔除多余空格 试题代码: func reverseWords(s string) string { strL ...
分类:
其他好文 时间:
2020-04-10 14:45:08
阅读次数:
72
一、异常的捕获和处理 KEY WORDS : try, catch, finally, throw, throws. (一)syntax(代码) try{ //需要运行的代码 }catch(异常类型 异常变量名){ //异常处理代码 }finally{ //异常发生,方法返回之前,需要执行的代码 } ...
分类:
编程语言 时间:
2020-04-10 09:12:44
阅读次数:
102
题目:https://vjudge.net/contest/364745#problem/B 先用三分求出最高点Y,然后在进行二分,求出角度 注意写法 PI的弧度是 acos(-1)/2-EPS接近90度的时候相当于除以0二分的精度可以用迭代次数来保证,比如100次 #include <iostre ...
分类:
其他好文 时间:
2020-04-10 00:57:31
阅读次数:
82
1 #jieba文本分析 2 import jieba 3 txt = open("C:/Users/86136/Documents/python文件测试/test.txt","rt",encoding="utf-8") 4 words=jieba.lcut(txt.read()) 5 counts ...
分类:
其他好文 时间:
2020-04-09 20:20:20
阅读次数:
108
前置知识: 混合图:一幅图中既有单向边,又有双向边。 混合图(既有有向边又有无向边的图)中欧拉环、欧拉路径的判定需要用到网络流这个算法!!! 有向图的欧拉回路的条件:所有的节点出度等于入度。 下面这两题基本差不多,但是建边啊、判断欧拉图啊等还是有区别的。 总之最后都是需要判断是否为满流,如果为满流则 ...
分类:
其他好文 时间:
2020-04-09 14:11:58
阅读次数:
134
题意 给一个字符串$s$,求最长回文子串 题解 马拉车算法的模板题。 首先,预处理字符串$s$,在每个字符的左边和右边都插上一个特殊符号,比如 ,目的是保证字符串的长度为奇数。举例来说, $\rightarrow$ ,`abcd a b c d a b c @ a b c $`。(如果声明的是全局变 ...
分类:
其他好文 时间:
2020-04-08 22:34:50
阅读次数:
73
"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. "The second problem is, given an positiv ...
分类:
其他好文 时间:
2020-04-08 22:33:31
阅读次数:
83
Problem Description Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes ...
分类:
其他好文 时间:
2020-04-08 19:31:25
阅读次数:
68
一、对新时代中国特色社会主义做词频统计 import jieba txt = open("新时代中国特色社会主义.txt","r",encoding="utf-8").read() words = jieba.lcut(txt) counts = {} for word in words: if l ...
分类:
其他好文 时间:
2020-04-08 11:34:30
阅读次数:
103
我太难了 $HDU$ 卡前向星 , $POJ$ 卡 $vector$ 我真的是服了 Description "link" 给定一棵树,要求支持如下操作: $1.$ 单点修改权值 $2.$ 查询经过某点的权值和最大的链 Solution 其实挺简单的吧,就是先一遍 $dfs$ 把树上的权值搞个前缀和 ...
分类:
其他好文 时间:
2020-04-08 10:02:41
阅读次数:
58