摘要: 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 阅读全文
posted @ 2017-08-05 17:10 阿波罗2003 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-05 16:49 阿波罗2003 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-05 15:48 阿波罗2003 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-05 14:16 阿波罗2003 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-08-05 13:42 阿波罗2003 阅读(342) 评论(0) 推荐(0) 编辑