1 qq_45323960

尚未进行身份认证

我要认证

此人很菜,什么都没有写

等级
TA的排名 1w+

阔力梯的树

链接:https://ac.nowcoder.com/acm/contest/4010/E来源:牛客网题目描述阔力梯有一棵树,这棵树有N{N}N个节点,每个节点按顺序编号为1−N{1-N}1−N,其中,1{1}1号节点是根结点。定义树上一个节点的“结实程度”为,将这个节点的子树中的所有的节点编号拿出来之后,按照从小到大的顺序排列,然后将相邻元素做差之后求平方和。即假设子树的节点编号排序后的序列为a1,a2,a3,...,aka_1,a_2,a_3,...,a_ka1​,a2​,a3​,...,ak​

2020-07-09 19:53:50

Tree Modification

You are given a tree with nnn vertices. You are allowed to modify the structure of the tree through the following multi-step operation:Choose three vertices aaa, bbb, and ccc such that bbb is adjacent to both aaa and ccc.For every vertex ddd other than b

2020-07-05 21:30:49

Inversion SwapSort

Madeline has an array aa of nn integers. A pair (u,v)(u, v)(u,v) of integers forms an inversion in aa if:1≤u<v≤n1 \le u < v \le n1≤u<v≤n.au>ava_u > a_vau​>av​.Madeline recently found a magical paper, which allows her to write two ind

2020-07-05 18:39:30

Replace by MEX

You’re given an array of nnn integers between 000 and nnn inclusive.In one operation, you can choose any element of the array and replace it by the MEX of the elements of the array (which may change after the operation).For example, if the current array

2020-07-05 11:21:14

2019 年实验班选拔试题

1.最大公约数(10分)题目描述:已知两个正整数aaa和bbb,求这两个数的最大公约数GCD(a,b)GCD(a,b)GCD(a,b)。输入格式:测试数据包括多组数据。测试数据的第一行是一个整数n (n<50)n\ (n<50)n (n<50),表示有nnn组输入数据。其后有nnn行数据,每行数据包括由空格分隔的两个正整数aaa和bbb。输出格式:对于每组测试数据,输出一行,给出对应输入数据的GCD(a,b)GCD(a,b)GCD(a,b)。输入样例:124

2020-07-04 17:39:55

2017 年实验班选拔试题

求和号(10 分)题目描述:在数学运算中经常要计算连续的和。例如,计算1+2+⋯+n1 + 2 + ⋯ + n1+2+⋯+n,或者等比数列a+a2+⋯+ana + a^2 + ⋯ + a^na+a2+⋯+an。我们使用求和号在“∑∑∑”来表示这类连续的和。通常在“∑∑∑”的下方标自变量名称和初始值,在“∑∑∑”的上方标终止值,在“∑∑∑”的右方写表达式,求和号也可以嵌套使用,例如:∑i=13∑j=12aibj=a1b1+a1b2+a2b1+a2b2+a3b1+a3b2\sum\limits_{i=1.

2020-07-03 13:46:28

2016 年实验班选拔试题

SUM(10 分)题目描述:求出在 1 到 N 之间的所有整数的总和。输入格式:输入包含多组测试数据。每行是一组测试数据,该数据是一个绝对值不大于 10000 的整数 N。N=0 时,表示输入结束。输出格式:对于每组测试数据,输出一行,改行包含一个整数,是所有在 1 到 N 之间的整数的总和。输入样例:-30输出样例:-5 求和公式#include<bits/stdc++.h>using namespace std;int n;int main() { .

2020-07-01 15:32:45

Cyclic Shifts Sorting

You are given an array a consisting of n integers.In one move, you can choose some index i(1≤i≤n−2)i (1≤i≤n−2)i(1≤i≤n−2) and shift the segment [ai,ai+1,ai+2][a_i,a_{i+1},a_{i+2}][ai​,ai+1​,ai+2​] cyclically to the right (i.e. replace the segment [ai,ai+1,

2020-06-30 10:40:43

Postman

A postman delivers letters to his neighbors in a one-dimensional world.The post office, which contains all of the letters to begin with, is located at x=0x = 0x=0, and there aren houses to which the postman needs to deliver the letters. House iii is locat

2020-06-20 19:31:38

Barbells

Your local gym has n barbells and m plates. In order to prepare a weight for lifting, you mustchoose a single barbell, which has two sides. You then load each side with a (possibly empty) setof plates. For safety reasons, the plates on each side must sum t

2020-06-20 19:23:51

Illumination

You inherited a haunted house. Its floor plan is an nnn-by-nnn square grid with lll lamps in fixedlocations and no interior walls. Each lamp can either illuminate its row or its column, but not bothsimultaneously. The illumination of each lamp extends by r

2020-06-20 19:12:07

Task On The Board

Polycarp wrote on the board a string sss containing only lowercase Latin letters (‘a’-‘z’). This string is known for you and given in the input.After that, he erased some letters from the string sss, and he rewrote the remaining letters in any order. As a

2020-06-17 16:13:22

Ehabs Last Corollary

Given a connected undirected graph with nnn vertices and an integer kkk, you have to either:either find an independent set that has exactly ⌈k2⌉⌈\frac{k}{2}⌉⌈2k​⌉ vertices.or find a simple cycle of length at most kkk.An independent set is a set of ver

2020-06-14 15:24:19

Swapping Places

Animals are waiting in a line, in a quarantine zone, before they can enter a hunting-free area, where they will find an easier life.When entering the quarantine zone, animals have to check in with a guard. The guard writes down the animal species, and the

2020-06-14 11:14:34

Ehab and Prefix MEXs

Given an array aaa of length nnn, find another array, bbb, of length nnn such that:for each i (1≤i≤n) MEX(b1,b2,…,bi)=aii \ (1≤i≤n)\ MEX({b_1, b_2, …, b_i})=a_ii (1≤i≤n) MEX(b1​,b2​,…,bi​)=ai​.The MEXMEXMEX of a set of integers is the

2020-06-14 09:55:35

Birdwatching

Kiara studies an odd species of birds that travel in a very peculiar way. Their movements are best explained using the language of graphs: there exists a directed graph GGG where the nodes are trees, and a bird can only fly from a tree TaT_aTa​ to TbT_bTb​

2020-06-13 22:56:37

Practice for KD Tree

链接:https://ac.nowcoder.com/acm/problem/201927来源:牛客网题目描述It’s time to have a break and implement something.You are given an n×nn\times nn×n matrix A{A}A. All the elements are zero initially.First, you need to perform m1m_1m1​ range addition operations.

2020-06-11 00:25:02

城市排水

在一个n×nn×nn×n的方块城市中,坐标为(i,j)(i,j)(i,j)的位置高度为h[i,j]h[i,j]h[i,j],有mmm个排水井,分别位于(xi,yi)(x_i,y_i)(xi​,yi​)在一场大雨中,每个位置的水都会往相邻的积水更低的地方流动,如果无法排出将越积越高排水井处永远不会积水,水不会通过城市边缘排出(可以理解为城市边缘是无限高的墙)求每个位置的积水深度输入描述第一行输入一个整数TTT,代表有TTT组测试数据 对于每一组测试数据,第一行输入222个整数n,mn,mn,m,接下

2020-06-08 19:30:29

选根

有一颗有nnn个结点树,结点被编号为111~nnn,记根结点深度为111,如果第iii个结点的深度是ddd,则它贡献的价值是d×wid\times{w_i}d×wi​ ,这棵树的价值是所有结点的价值和 求当根结点为111~nnn时,树的价值分别为多少输入描述第一行输入一个整数TTT,代表有TTT组测试数据 对于每一组测试数据,第一行有111个整数nnn,第二行有nnn个整数wiw_iwi​,接下来n−1n-1n−1行每行有两个整数x,yx,yx,y表示xxx和yyy之间有一条边输出描述对于每组测试

2020-06-08 13:11:11

再来异或

给你具有nnn个结点n−1n-1n−1条边的无向无环连通图,结点编号1∼n1 \sim n1∼n,每条边上有一个数作为他的边权,定义函数f(i,j)f(i,j)f(i,j)为连接i,ji,ji,j的简单路径的所有边权的异或值求⨁i=1n⨁j=inf(i,j)\displaystyle \bigoplus_{i=1}^n \bigoplus_{j=i}^n f(i,j)i=1⨁n​j=i⨁n​f(i,j),⊕\oplus⊕为按位异或运算,⨁i=lri\displaystyle \bigoplus_{i=l}

2020-06-07 19:40:25

查看更多

勋章 我的勋章
  • 签到达人
    签到达人
    累计签到获取,不积跬步,无以至千里,继续坚持!
  • 阅读者勋章Lv2
    阅读者勋章Lv2
    授予在CSDN APP累计阅读博文达到7天的你,是你的坚持与努力,使你超越了昨天的自己。
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 1024勋章
    1024勋章
    #1024程序员节#活动勋章,当日发布原创博客即可获得
  • 勤写标兵Lv4
    勤写标兵Lv4
    授予每个自然周发布9篇以上(包括9篇)原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。