题目传送门(内部题91) 输入格式 第一行一个正整数$N$,表示颜色种类数。 第二行$N$个正整数$k[i],k[i]$表示第$i$种颜色的数量$(1\leqslant k[i]\leqslant 3)$。 输出格式 一个整数,表示相同颜色的小球不相邻的方案数。 样例 样例输入1: 31 2 3 样 ...
分类:
其他好文 时间:
2019-10-27 13:04:48
阅读次数:
68
题目链接http://codeforces.com/contest/1249/problem/B2 。并查集思想,将数分成多个集合,每个集合的大小就是一轮的所需天数。 Map[i]存储数据。 flag[i]来表示第i个数是否被访问过。 mm[i]记录第i个集合所对应的集合大小,索引i为第i个集合的根 ...
分类:
其他好文 时间:
2019-10-27 12:52:10
阅读次数:
97
Difficulty:easy More:【目录】LeetCode Java实现 Description https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maximum ...
分类:
其他好文 时间:
2019-10-27 11:10:58
阅读次数:
69
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font ...
分类:
其他好文 时间:
2019-10-27 10:18:05
阅读次数:
91
JDBC的一些简单通用代码 功能包括 连接数据库 查询操作 执行sql语句 jdbc相关类的加载 关闭连接 获取数据库格式的当前时间 代码 ...
分类:
数据库 时间:
2019-10-27 01:27:59
阅读次数:
115
思路很简单,使用两个指针i和j,分别用来遍历字符串a和字符串b。使用一个全局变量carry来记录其进位,使用一个局部变量sum来记录每一次指针所指向的数字相加之和与carry的和。然后,重新给carry和sum赋值,让sum和carry等于0或1。最后如果carry等于1,就需要将它append。最 ...
分类:
其他好文 时间:
2019-10-27 01:21:37
阅读次数:
76
https://www.acwing.com/problem/content/787/ 快排 双向指针 ...
分类:
编程语言 时间:
2019-10-27 01:21:04
阅读次数:
115
高并发情况下对缓存进行读取-修改操作时,需要原子性操作,Redis本身提供一个一些命令,例如incrby、hincrby自增(减)命令,但是这些命令在有些业务中不适用,这种情况下就可以使用lua脚本来实现多命令的执行(读、写); 以下lua脚本,通常lua脚本只需要加载一次,然后使用redis返回的 ...
分类:
其他好文 时间:
2019-10-27 01:20:36
阅读次数:
95
父页面给子页面传值 father.jsp 父页面 <body> ...
分类:
其他好文 时间:
2019-10-27 01:20:06
阅读次数:
126
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a conca ...
分类:
其他好文 时间:
2019-10-27 01:14:53
阅读次数:
76