About a year ago, I came to Bali, Indonesia, as an international volunteer with my classmates. Our work is mainly to help sea turtles breed and clean the beach. But we haven’t been to Bali, so we do
I. Interesting Permutation time limit per test 1 second memory limit per test 512 megabytes DreamGrid has an interesting permutation of 1,2,…,n denoted by a1,a2,…,an. He generates three sequences f,
题目: Undoubtedly you know of the Fibonacci numbers. Starting with F_1 = 1F1=1 and F_2 = 1F2=1,every next number is the sum of the two previous ones. This results in the sequence 1, 1, 2, 3, 5, 8
We’ll call an array of n non-negative integers a[1], a[2], …, a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning
题目链接 You are given two integers l and r, where l<r. We will add 1 to l until the result is equal to r. Thus, there will be exactly r−l additions performed. For each such addition, let’s look at the nu
Description xyiyy和yaoge正在做一个游戏。现在yaoge面临这游戏中关键的一步,如果不能算出这个结果,那么他将要付出一块鸡排的代价。 现在yaoge有两个数A和B,yaoge对这两个数进行k次操作,每次操作定义如下: 若A≤B,则B = B - A,A = A + A 若A>B,则A = A - B,B = B + B 现要求求出k次操作之后较小的那个数的值 Inpu
描述 Jamie has recently found undirected weighted graphs with the following properties very interesting: The graph is connected and contains exactly n vertices and m edges. All edge weights are inte