
HackerRank
文章平均质量分 68
spongewxy
这个作者很懒,什么都没留下…
展开
-
Find Median
Problem StatementThe median of a finite list of numbers can be found by arranging all the integers from lowest to highest value and picking the middle one. For example, the median of {3,3,5,9,原创 2015-05-29 09:45:51 · 596 阅读 · 0 评论 -
Mr. X and His Shots
这里写链接内容#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <vector>#include <iostream>#include <algorithm>using namespace std;const int maxn = 100010;struct Line {原创 2016-07-21 22:13:04 · 589 阅读 · 0 评论 -
Coloring Tree
给你一棵N个节点的树(无向无环连通图),每个节点有一个颜色。你知道树的根节点(树的根节点是一个特殊的节点,是树节点中唯一没有父节点的)。颜色用1到109范围内的整数表示。现在,你需要回答M个查询,每个查询询问以节点s为根的子树节点中,不同颜色的数目。(s会在输入中给出)。输入格式第一行包含3个空格分隔的整数 (N M root)表示树的节点数、查询数和根节点。接下来N行,每行包含着2个空格分隔的整数原创 2016-07-21 20:00:30 · 685 阅读 · 0 评论 -
Library Query
Library Query解题思路:建立1000棵树状数组维护一下即可。#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <vector>#include <deque>#include <queue>#include <stack>#include <map>#include原创 2016-07-25 23:11:49 · 448 阅读 · 0 评论 -
Truck Tour
Problem StatementSuppose there is a circle. There are N petrol pumps on that circle. Petrol pumps are numbered 0 to (N−1) (both inclusive). You have two pieces of information corresponding原创 2015-05-28 11:32:15 · 1236 阅读 · 0 评论 -
Xoring Ninja
Problem Statement给定一个长度为N的集合,对其进行XOR_SUM(异或和)运算,定义为:计算它每个非空子集进行异或运算的结果之和,输出这个和% 109 + 7的结果。一个集合的异或结果是其中所有元素的异或运算的结果例如,集合{A,B,C}异或的结果 = ((A^B)^C), 其中 ^ 表示 异或运算XOR。因此, 对包含3个元素的集合A = {X1,原创 2015-07-03 15:25:33 · 723 阅读 · 0 评论 -
Manipulative Numbers
Problem StatementSuppose that A is a list of n numbers {A1,A2,A3,…,An} and B={B1,B2,B3,..,Bn} is a permutation of these numbers, we say B is K-Manipulative if and only if:M(B)=minimum(原创 2015-07-05 19:18:00 · 1008 阅读 · 0 评论 -
String Transmission
Problem StatementBob has received a binary string of length N transmitted by Alice. He knows that due to errors in transmission, up to K bits might have been corrupted (and hence flipped). Howev原创 2015-07-05 16:49:41 · 981 阅读 · 0 评论 -
Kundu and Tree
Problem StatementRussianChineseKundu是树的一个真正爱好者。树是一个包含N个点和N-1条边的连通图。今天,当他得到一棵树的时候,他给每条边涂上红色(‘r’)和黑色(’b’)之中的一种颜色。他有兴趣知道有多少个节点的三元组(a,b,c)满足在节点a到节点b、节点b到节点c和节点c到节点a的路径上,每条路径都至少有一条边是红色的。 请注原创 2015-05-29 15:55:30 · 682 阅读 · 0 评论 -
Minimum Average Waiting Time
Problem StatementTieu owns a pizza restaurant and he manages it in his own way. While in a normal restaurant, a customer is served by following the first-come, first-served rule, Tieu simply m原创 2015-05-29 12:02:37 · 1427 阅读 · 0 评论 -
Subsequence Weighting
题目链接#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <vector>#include <set>#include <map>#include <iostream>#include <algorithm>using namespace std;typedef long l原创 2016-07-21 23:21:02 · 404 阅读 · 0 评论