Spoj MKTHNUM - K-th Number】的更多相关文章

题目链接:http://poj.org/problem?id=2104 Description You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickl…
题目描述 English Vietnamese You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics…
K - Relevant Phrases of Annihilation 题目大意:给你 n 个串,问你最长的在每个字符串中出现两次且不重叠的子串的长度. 思路:二分长度,然后将height分块,看是否存在一个块里面 每个串都符合条件. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int, int&…
A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying two smaller natural numbers. Now lets define a number NN as the supreme number if and only if each number made up of an non-empty subsequence of all…
题目背景 这是个非常经典的主席树入门题--静态区间第K小 数据已经过加强,请使用主席树.同时请注意常数优化 题目描述 如题,给定N个正整数构成的序列,将对于指定的闭区间查询其区间内的第K小值. 输入输出格式 输入格式: 第一行包含两个正整数N.M,分别表示序列的长度和查询的个数. 第二行包含N个正整数,表示这个序列各项的数字. 接下来M行每行包含三个整数 l, r, kl,r,k , 表示查询区间 [l, r][l,r] 内的第k小值. 输出格式: 输出包含k行,每行1个正整数,依次表示每一次查…
https://nanti.jisuanke.com/t/31452 题意 给出一个n (2 ≤ N ≤ 10100 ),找到最接近且小于n的一个数,这个数需要满足每位上的数字构成的集合的每个非空子集组成的数字是个素数或1. 分析 打表发现满足要求的数字很少.实际上因为一个数不能出现两次,而偶数不能存在.这样最后只有20个数符合要求. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; ; ] = {,,,…
From: http://www.geeksforgeeks.org/find-number-of-triangles-possible/ Given an unsorted array of positive integers. Find the number of triangles that can be formed with three different array elements as three sides of triangles. For a triangle to be…
1单节点上的topK (1)批量数据 数据结构:HashMap, PriorityQueue 步骤:(1)数据预处理:遍历整个数据集,hash表记录词频 (2)构建最小堆:最小堆只存k个数据. 时间复杂度:O(n +n*lgk) = O(nlgk) 空间复杂度:O(|n|+k) (|n| = number of unique words) lintcode原题:Top K Frequent Words (2)流式数据 数据结构:TreeMap, HashMap 步骤:有新数据到来时,HashMa…
F. Restore a Number   Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
总时间限制:  1000ms 内存限制:  65536kB 描述 输入两个正整数 m 和 k,其中1 < m < 100000,1 < k < 5 ,判断 m 能否被19整除,且恰好含有k个3,如果满足条件,则输出YES,否则,输出NO. 例如,输入: 43833 3 满足条件,输出YES. 如果输入:39331 3 尽管有3个3,但不能被19整除,也不满足条件,应输出NO. 输入 m 和 k 的值,中间用单个空格间隔. 输出 满足条件时输出 YES,不满足时输出 NO. 样例输入…