地址 https://leetcode-cn.com/problems/integer-replacement/ 给定一个正整数 n,你可以做如下操作: 1. 如果 n 是偶数,则用 n / 2替换 n。 2. 如果 n 是奇数,则可以用 n + 1或n - 1替换 n。 n 变为 1 所需的最小替 ...
分类:
其他好文 时间:
2020-06-09 23:42:46
阅读次数:
76
创建半透明的窗口,以及在窗口上绘制不透明的文本 方法: 创建Bitmap具有PixelFormat32bppPARGB像素格式的GDI + 对象。 创建一个Graphics对象以绘制该Bitmap对象。 使用GDI +将所有图形绘制到该对象中。 销毁Graphics在步骤2中创建的对象。 GetHB ...
# 将罗马数字转换成整型# class Solution:# def romanToInt(self, s):# d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}# num = 0# for i in rang ...
分类:
其他好文 时间:
2020-06-09 14:49:56
阅读次数:
57
随机生成6位验证码代码 # -*- coding: utf-8 -*- import random def generate_verification_code(): ''' randomly generated a 6 bit verification code ''' code_list = [ ...
分类:
编程语言 时间:
2020-06-09 09:55:45
阅读次数:
74
Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. Return the array in the form [x1,y1,x2,y2,...,xn,yn]. Example ...
分类:
其他好文 时间:
2020-06-09 09:20:59
阅读次数:
68
非递归遍历二叉树借用List实现的,具体实现方法如下。前序遍历非递归代码实现:publicList<Integer>preOrder(TreeNoderoot){List<Integer>list=newArrayList<>();if(root==null){returnlist;}list.add(root.val);//根据前序遍历的特性,先将根节点的值加
分类:
其他好文 时间:
2020-06-09 09:17:36
阅读次数:
64
pg 常用字段类型: 类型 存储长度 描述 int2/smallint 2字节 小范围整数 int4/integer 4字节 常用的整数 varchar(n) 变长 有长度限制 bool 1字节 true/false timestamp 8字节 日期和时间(无时区) 主键: 指的是一个列或多列的组合 ...
分类:
其他好文 时间:
2020-06-08 20:45:34
阅读次数:
122
1 hibernate要求实体类里面有一个属性作为唯一值,对应表主键,主键可以不同生成策略 1 <!-- 设置数据库id值生成策略 2 native:生成表id值就是自动增长--> 3 <id name="role_id" column="role_id"> 4 <generator class=" ...
分类:
Web程序 时间:
2020-06-08 20:41:57
阅读次数:
82
有没有一种组合字体,中文是宋体,英文是times new roman? 由于日常科研工作书写需要,想问问各位大神有没有一种字体,中文是宋体,西文是times new roman,这样写论文好方便啊有没有,只要设置一种字体就可以了。另外比如R画图,一个对象只能用一种字体,那比如横坐标既有中文又有英文符 ...
分类:
其他好文 时间:
2020-06-08 19:29:33
阅读次数:
229
public class FunctionDemo { public static void main(String[] args) { convert("100", s -> Integer.parseInt(s)); convert(100, i -> String.valueOf(i + 56 ...
分类:
其他好文 时间:
2020-06-08 19:06:20
阅读次数:
65