给出一个由小写英文字母组成的字符串S,再给出q个询问,要求回答S某个子串的最短循环节。如果字符串B是字符串A的循环节,那么A可以由B重复若干次得到。Input第一行一个正整数n (n<=500,000),表示S的长度。第二行n个小写英文字母,表示字符串S。第三行一个正整数q (q<=2,000,00 ...
分类:
其他好文 时间:
2020-02-12 00:49:16
阅读次数:
82
在java里类的关系大致分为三种, 1.继承(a is b):继承extends,实现implement 2.包含(a has b):组合>聚合>关联。关系亲密度越来越小,一个类在另一个类中声明为属性。 3.依赖(a use b):一个类中用到了别的类对象,比如a类的方法中创建b的对象并使用其属性跟 ...
分类:
编程语言 时间:
2020-02-11 14:21:46
阅读次数:
72
快速幂 前置知识 位运算 指数幂的运算 对这两个不熟悉的要到网上去看看或查找其他便民设施 快速幂的简介及代码实现 快速幂就是用来快速计算$a^b$的值(~~废话~~),朴素算法计算是$O(n)$的时间复杂度,快速幂能优化到$O(logn)$。 我们用这道例题 "题目链接" 来讲一下快速幂的实现 以样 ...
分类:
其他好文 时间:
2020-02-11 00:45:57
阅读次数:
89
题目: Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents t ...
分类:
编程语言 时间:
2020-02-11 00:19:01
阅读次数:
110
题目 给定一个double类型的浮点数base和int类型的整数exponent,求base的exponent次方 保证base和exponent不同时为0。 1、用内置函数pow 语法: class Solution: def Power(self, base, exponent): # writ ...
分类:
其他好文 时间:
2020-02-10 22:52:00
阅读次数:
80
如果某个数 K 的平方乘以 N 以后,结果的末尾几位数等于 K,那么就称这个数为“N-自守数”。例如 3,而 2 的末尾两位正好是 9,所以 9 是一个 3-自守数。 本题就请你编写程序判断一个给定的数字是否关于某个 N 是 N-自守数。 输入格式: 输入在第一行中给出正整数 M(≤),随后一行给出 ...
分类:
其他好文 时间:
2020-02-10 19:52:10
阅读次数:
86
#include "stdio.h" double pow(double x,double y); void main(void) { double result; double x=2.0,y=3.0; result=pow(x,y); printf("%f的%f次方为%f",x,y,result ...
分类:
其他好文 时间:
2020-02-10 18:23:41
阅读次数:
76
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the ...
分类:
系统相关 时间:
2020-02-10 09:57:46
阅读次数:
68
题目如下: Implement the class TweetCounts that supports two methods: 1. recordTweet(string tweetName, int time) Stores the tweetName at the recorded time ...
分类:
其他好文 时间:
2020-02-09 18:10:45
阅读次数:
50
单台设备基于63G的数据量快速完成mysql主从搭建
分类:
数据库 时间:
2020-02-08 19:17:00
阅读次数:
82