CRAN02 - Roommate Agreement Leonard was always sickened by how Sheldon considered himself better than him. To decide once and for all who is better among them they decided to ask each other a puzzle. Sheldon pointed out that according to Roommate Agr…
Problem description. The Fibonacci numbers defined as f(n) = f(n-1) + f(n-2) where f0 = 0 and f1 = 1. We define a function as follows D(n,x) = x + x^2 + 2x^3 + 3x^4 + 5x^5 + 8x^6 +...+f(n)x^n Given two integers n and x, you need to compute D(n,x) sin…
题目 vjudge URL:Counting Divisors (square) Let σ0(n)\sigma_0(n)σ0(n) be the number of positive divisors of nnn. For example, σ0(1)=1\sigma_0(1) = 1σ0(1)=1, σ0(2)=2\sigma_0(2) = 2σ0(2)=2 and σ0(6)=4\sigma_0(6) = 4σ0(6)=4. Let S2(n)=∑i=1nσ0(i2).S_2(n…
COT - Count on a tree #tree You are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight. We will ask you to perform the following operation: u v k : ask for the kth minimum weight on the path from node u …