08 2017 档案
摘要:Little boy Igor wants to become a traveller. At first, he decided to visit all the cities of his motherland — Uzhlyandia. It is widely known that Uzhl
阅读全文
摘要:Grigory loves strings. Recently he found a metal strip on a loft. The strip had length n and consisted of letters "V" and "K". Unfortunately, rust has
阅读全文
摘要:Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can n
阅读全文
摘要:给定n个正整数a1,a2,…,an,求 的值(答案模10^9+7)。 Input 第一行一个正整数n。 接下来n行,每行一个正整数,分别为a1,a2,…,an。 Output 仅一行答案。 Sample Input Sample Output Hint 1<=n<=10^5,1<=ai<=10^7。
阅读全文
摘要:Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. The game consists of multiple rounds. Its rules are
阅读全文
摘要:Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting f
阅读全文
摘要:There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads. Theon a
阅读全文
摘要:Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side
阅读全文
摘要:Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies. At first, Arya and Bran
阅读全文
摘要:Sean owns a company and he is the BOSS.The other Staff has one Superior.every staff has a loyalty and ability.Some times Sean will fire one staff.Then
阅读全文
摘要:Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other knights are fun thin
阅读全文
摘要:一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一条u到v的有向路径或者从v到u的有向路径。若G'=(V',E')满足V'?V,E'是E中所有跟V'有关的边,则称G'是G的一个导出子图。若G'是G的导出子
阅读全文
摘要:Kyle is a student of Programming Monkey Elementary School. Just as others, he is deeply concerned with his grades. Last month, the school held an exam
阅读全文
摘要:描述 一条单向的铁路线上,依次有编号为 1, 2, ..., n 的 n 个火车站。每个火车站都有一个级别,最低为 1 级。现有若干趟车次在这条线路上行驶,每一趟都满足如下要求:如果这趟车次停靠了火车站 x,则始发站、终点站之间所有级别大于等于火车站 x 的都必须停靠。(注意:起始站和终点站自然也算
阅读全文
摘要:You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated b
阅读全文
摘要:描述 给一个空数列,有M次操作,每次操作是以下三种之一: (1)在数列后加一个数 (2)求数列中某位置的值 (3)撤销掉最后进行的若干次操作(1和3) 输入 第一行一个正整数M。 接下来M行,每行开头是一个字符,若该字符为'A',则表示一个加数操作,接下来一个整数x,表示在数列后加一个整数x;若该字
阅读全文
摘要:Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types o
阅读全文
摘要:The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence o
阅读全文
摘要:Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)), where gcd(a, b) is the g
阅读全文
摘要:Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k
阅读全文
摘要:You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can
阅读全文
摘要:Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains ai animals in it. Also there ar
阅读全文
摘要:In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, ea
阅读全文
摘要:At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in parti
阅读全文
摘要:Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings o
阅读全文
摘要:The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi), a maximum brightness c, equal for all
阅读全文
摘要:Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to
阅读全文
摘要:Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The f
阅读全文