phong605's blog

By phong605, 6 years ago, In English,

We define F sequence: F1 = a, F2 = b, Fi = Fi - 1 + Fi - 2 (3 ≤ i). You are given 4 positive integer n, L, R, K. Your task is check whether there exist two integer a, b that L ≤ a, b ≤ R and Fn = K.

Example:

  1. (n, L, R, K) = (3, 0, 10, 1) => output: YES.

  2. (n, L, R, K) = (3, 0, 10, 21) => output: NO.

Limit:

  1. 3 ≤ n ≤ 105

  2. 0 ≤ L ≤ R ≤ 100.

  3. K ≤ 1030000.

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it