题意翻译 求给定的两个数之间的素数 Translated by @kaiming 题目描述 Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all ...
分类:
其他好文 时间:
2018-06-30 12:45:31
阅读次数:
166
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the dep ...
分类:
其他好文 时间:
2018-06-28 18:19:28
阅读次数:
165
简介 树上莫队,顾名思义就是把莫队搬到树上。 我们从一道题目入手[SDOI2018]原题识别 SPOJ Count on a tree II 题目意思很明确:给定一个$n$个节点的树,每个节点表示一个整数,问$u$到$v$的路径上有多少个不同的整数。 像这种不带修改数颜色的题首先想到的肯定是树套树莫 ...
分类:
编程语言 时间:
2018-06-25 12:59:50
阅读次数:
748
题目描述 给定一个n个节点的树,每个节点表示一个整数,问u到v的路径上有多少个不同的整数。 输入格式 第一行有两个整数n和m(n=40000,m=100000)。 第二行有n个整数。第i个整数表示第i个节点表示的整数。 在接下来的n-1行中,每行包含两个整数u v,描述一条边(u,v)。 在接下来的 ...
分类:
其他好文 时间:
2018-06-24 21:07:11
阅读次数:
144
Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B a ...
分类:
其他好文 时间:
2018-06-24 20:53:33
阅读次数:
265
Given a balanced parentheses string S, compute the score of the string based on the following rule: Example 1: Input: "()" Output: 1 Example 2: Input: ...
分类:
其他好文 时间:
2018-06-24 16:12:06
阅读次数:
435
"Portal Spoj DIVCNTK" Solution 这题的话其实是。。洲阁筛模板题?差不多吧 题意就是给你一个函数$S_k(x)$ $$ S_k(n)=\sum\limits_{i=1}^{n} \sigma_0(i^k) $$ 其中$\sigma_0(x)$表示的是$x$的约数个数,现在 ...
分类:
其他好文 时间:
2018-06-17 20:50:06
阅读次数:
184
Implement a function to check if a binary tree is balanced. For the purpose of this question, a balanced tree is defined to be a tree such that the he ...
分类:
其他好文 时间:
2018-06-16 10:34:06
阅读次数:
169
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the dep ...
分类:
其他好文 时间:
2018-06-13 23:29:31
阅读次数:
188
A string is finite sequence of characters over a non empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called fa ...
分类:
其他好文 时间:
2018-06-10 11:42:53
阅读次数:
162