CF1264F.Beautiful Fibonacci Problem

NOI/NOI+/CTSC

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The well-known Fibonacci sequence $F_0, F_1, F_2,\ldots $ is defined as follows:

  • F0=0,F1=1F_0 = 0, F_1 = 1.
  • For each i≥2i \geq 2: Fi=Fi−1+Fi−2F_i = F_{i - 1} + F_{i - 2}.

Given an increasing arithmetic sequence of positive integers with nn elements: (a,a+d,a+2⋅d,…,a+(n−1)⋅d)(a, a + d, a + 2\cdot d,\ldots, a + (n - 1)\cdot d).

You need to find another increasing arithmetic sequence of positive integers with nn elements (b,b+e,b+2⋅e,…,b+(n−1)⋅e)(b, b + e, b + 2\cdot e,\ldots, b + (n - 1)\cdot e) such that:

  • 0<b,e<2640 \lt b, e \lt 2^{64},
  • for all 0≤i<n0\leq i \lt n, the decimal representation of a+i⋅da + i \cdot d appears as substring in the last 1818 digits of the decimal representation of Fb+i⋅eF_{b + i \cdot e} (if this number has less than 1818 digits, then we consider all its digits).

著名的斐波那契数列 $F_0, F_1, F_2,\ldots $ 定义如下:

  • F0=0,F1=1F_0 = 0, F_1 = 1;
  • 对每个 i≥2i \geq 2,有 Fi=Fi−1+Fi−2F_i = F_{i - 1} + F_{i - 2}。

给定一个由 nn 个正整数组成的严格递增等差数列:(a,a+d,a+2⋅d,…,a+(n−1)⋅d)(a, a + d, a + 2\cdot d,\ldots, a + (n - 1)\cdot d)。

你需要找到另一个由 nn 个正整数组成的严格递增等差数列 (b,b+e,b+2⋅e,…,b+(n−1)⋅e)(b, b + e, b + 2\cdot e,\ldots, b + (n - 1)\cdot e),使得:

  • 0<b,e<2640 \lt b, e \lt 2^{64};
  • 对所有 0≤i<n0\leq i \lt n,a+i⋅da + i \cdot d 的十进制表示作为子串出现在 Fb+i⋅eF_{b + i \cdot e} 的十进制表示的末 18 位数字中(若该数不足 18 位,则取其全部数字)。

输入格式

The first line contains three positive integers nn, aa, dd (1≤n,a,d,a+(n−1)⋅d<1061 \leq n, a, d, a + (n - 1) \cdot d \lt 10^6).

第一行包含三个正整数 nn、aa、dd(1≤n,a,d,a+(n−1)⋅d<1061 \leq n, a, d, a + (n - 1) \cdot d \lt 10^6)。

输出格式

If no such arithmetic sequence exists, print −1-1.

Otherwise, print two integers bb and ee, separated by space in a single line (0<b,e<2640 \lt b, e \lt 2^{64}).

If there are many answers, you can output any of them.

如果不存在这样的等差数列,则输出 −1-1。

否则,在一行中输出两个整数 bb 和 ee,用空格分隔(0<b,e<2640 \lt b, e \lt 2^{64})。

如果存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    3 1 1

    输出#1

    2 1
  • 输入#2

    5 1 2

    输出#2

    19 5

说明/提示

In the first test case, we can choose (b,e)=(2,1)(b, e) = (2, 1), because F2=1,F3=2,F4=3F_2 = 1, F_3 = 2, F_4 = 3.

In the second test case, we can choose (b,e)=(19,5)(b, e) = (19, 5) because:

  • F19=4181F_{19} = 4181 contains 11;
  • F24=46368F_{24} = 46368 contains 33;
  • F29=514229F_{29} = 514229 contains 55;
  • F34=5702887F_{34} = 5702887 contains 77;
  • F39=63245986F_{39} = 63245986 contains 99.

在第一个测试用例中,我们可以选择 (b,e)=(2,1)(b, e) = (2, 1),因为 F2=1, F3=2, F4=3F_2 = 1,\ F_3 = 2,\ F_4 = 3。

在第二个测试用例中,我们可以选择 (b,e)=(19,5)(b, e) = (19, 5),因为:

  • F19=4181F_{19} = 4181 包含数字 11;
  • F24=46368F_{24} = 46368 包含数字 33;
  • F29=514229F_{29} = 514229 包含数字 55;
  • F34=5702887F_{34} = 5702887 包含数字 77;
  • F39=63245986F_{39} = 63245986 包含数字 99。

输入解题思路,AI测评打分。不知道怎么写?

首页