08 2019 档案
摘要:You are given nn integer numbers a1,a2,…,ana1,a2,…,an. Consider graph on nn nodes, in which nodes ii, jj (i≠ji≠j) are connected if and only if, aiaiAN
阅读全文
摘要:You are given a line of nn colored squares in a row, numbered from 11 to nn from left to right. The ii-th square initially has the color cici. Let's s
阅读全文
摘要:The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin
阅读全文
摘要:一个字 就是骚~感觉以后写博客都省了
阅读全文
摘要:Ural大学有N名职员,编号为1~N。 他们的关系就像一棵以校长为根的树,父节点就是子节点的直接上司。 每个职员有一个快乐指数,用整数 HiHi 给出,其中 1≤i≤N1≤i≤N。 现在要召开一场周年庆宴会,不过,没有职员愿意和直接上司一起参会。 在满足这个条件的前提下,主办方希望邀请一部分职员参会
阅读全文
摘要:Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly
阅读全文
摘要:在完成了分配任务之后,西部314来到了楼兰古城的西部。 相传很久以前这片土地上(比楼兰古城还早)生活着两个部落,一个部落崇拜尖刀(‘V’),一个部落崇拜铁锹(‘∧’),他们分别用V和∧的形状来代表各自部落的图腾。 西部314在楼兰古城的下面发现了一幅巨大的壁画,壁画上被标记出了N个点,经测量发现这N
阅读全文
摘要:Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt
阅读全文
摘要:Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhi
阅读全文
摘要:P is a permutation of the integers from 1 to N(index starting from 1). Here is the code of Bubble Sort in C++. for(int i=1;i<=N;++i) for(int j=N,t;j>i
阅读全文
摘要:在郊区有 N 座通信基站,P 条双向电缆,第 i 条电缆连接基站AiAi和BiBi。 特别地,1 号基站是通信公司的总站,N 号基站位于一座农场中。 现在,农场主希望对通信线路进行升级,其中升级第 i 条电缆需要花费LiLi。 电话公司正在举行优惠活动。 农产主可以指定一条从 1 号基站到 N 号基
阅读全文
摘要:给定长度为N的数列A,以及M条指令,每条指令可能是以下两种之一: 1、“1 x y”,查询区间 [x,y] 中的最大连续子段和,即 maxx≤l≤r≤ymaxx≤l≤r≤y{∑ri=lA[i]∑i=lrA[i]}。 2、“2 x y”,把 A[x] 改成 y。 对于每个查询指令,输出一个整数表示答案
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/16/A来源:牛客网 题目描述 FST是一名可怜的小朋友,他很强,但是经常fst,所以rating一直低迷。 但是重点在于,他非常适合ACM!并在最近的区域赛中获得了不错的成绩。 拿到奖金后FST决定买一台新笔记本,但是F
阅读全文
摘要:思路及代码参考:https://blog.csdn.net/u014800748/article/details/45420085 There is an infinite sequence consisting of all positive integers in the increasing
阅读全文
摘要:Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Ma
阅读全文
摘要:Description You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked t
阅读全文
摘要:Problem Description String matching is a common type of problem in computer science. One string matching problem is as following:Given a string s[0…le
阅读全文
摘要:Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Ma
阅读全文
摘要:In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacen
阅读全文
摘要:Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly
阅读全文
摘要:Recently, Shua Shua had a big quarrel with his GF. He is so upset that he decides to take a trip to some other city to avoid meeting her. He will trav
阅读全文
摘要:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,
阅读全文
摘要:Problem Description There are n stones numbered from 1 to n.The weight of the i-th stone is i kilograms. We divide the stones into k groups.Each group
阅读全文