时间复杂度O(n) 空间复杂度O(1) 1 #include <cstdio> 2 int main() { 3 int T;scanf("%d",&T); 4 for(int t=1,n,a,l,r,s,L,R,S;t<=T;t++) { 5 scanf("%d",&n),l=L=R=1; 6 f ...
分类:
编程语言 时间:
2020-02-08 15:32:38
阅读次数:
52
11.1 选择语句--switch switch语句格式: 1 switch(表达式){ 2 case 常量值1: 3 语句体1; 4 break; 5 case 常量体2; 6 语句体2; 7 break; 8 ... 9 default; 10 语句体n+1; 11 break; 12 } 执行 ...
分类:
其他好文 时间:
2020-02-08 15:18:09
阅读次数:
70
1.设计思路和遇到的问题 完成一个口算生成器,具体怎么操作,经过度娘的指导,发现就是一个较难的编程题吧,只是换了一个软件进行编辑。简单来说注重题目给出的六个函数,文字部分则使用printf输入即可 。其实最主要的难题是如何使用switch语句,在什么地方什么时候。是一个难题吧。主要是自己不太清楚。 ...
分类:
编程语言 时间:
2020-02-08 13:44:58
阅读次数:
79
Given a string s and an integer k, find out if the given string is a K-Palindrome or not. A string is K-Palindrome if it can be transformed into a pal ...
分类:
其他好文 时间:
2020-02-08 10:14:38
阅读次数:
74
魔术方法 在python中,以双下划线开头、双下划线结尾的方法我们称之为魔术方法。例如__init__ 魔术方法是python内部定义好的,我们不需要去创建。 1.__new__方法和单例模式 __new__方法:Create and return a new object.创建对象时触发 clas ...
分类:
其他好文 时间:
2020-02-08 10:10:54
阅读次数:
121
1、Thymeleaf 目标 迭代语法:th:each; iteration status 条件语法:th:if; th:unless switch语法:th:switch; th:case; * 2、公共模拟SpringBoot 后台接口 后台逻辑(action) // 分页查询 @Request ...
分类:
其他好文 时间:
2020-02-07 22:42:20
阅读次数:
85
最近在使用python3,同样装了nose,发现自动发现用例总是有问题,如下面的代码结婚 testcase | __init__.py | test_bb.py test_bb.py中文件为: def test_qq(): pass Python3中: 再使用nose执行testcase提示: Ra ...
分类:
编程语言 时间:
2020-02-07 20:36:36
阅读次数:
75
O(n^2)的方法,最后一个case超时。需要用kmp方法或者manacher方法才能O(n),先忽略了。 class Solution: def isPalindrome(self, sub: str) -> bool: for i in range(len(sub) // 2): if sub[ ...
分类:
其他好文 时间:
2020-02-07 18:29:59
阅读次数:
48
import java.io.File; import java.util.Scanner; import java.io.PrintWriter; class Demo { public static void main(String[] args) throws Exception { Scan ...
分类:
其他好文 时间:
2020-02-07 16:54:34
阅读次数:
122