CF913G.Power Substring

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You are given n positive integers _a_1, _a_2, ..., a__n.

For every a__i you need to find a positive integer k__i such that the decimal notation of 2_k__i_ contains the decimal notation of a__i as a substring among its last min(100, length(2_k__i_)) digits. Here length(m) is the length of the decimal notation of m.

Note that you don't have to minimize k__i. The decimal notations in this problem do not contain leading zeros.

给你 nn 个正整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n。

对每个 aia_i,你需要找出一个正整数 kik_i,使得 2ki2^{k_i} 的十进制表示中,其末尾 min⁡(100, length(2ki))\min(100,\,\text{length}(2^{k_i})) 位数字所构成的字符串中,包含 aia_i 的十进制表示作为子串。其中 length(m)\text{length}(m) 表示 mm 的十进制表示的长度。

注意:你无需最小化 kik_i。本题中所有十进制表示均不含前导零。

输入格式

The first line contains a single integer n (1 ≤ n ≤ 2 000) — the number of integers a__i.

Each of the next n lines contains a positive integer a__i (1 ≤ a__i < 1011).

第一行包含一个整数 nn(1≤n≤2 0001 \leq n \leq 2\,000)—— 表示整数 aia_i 的个数。

接下来的 nn 行,每行包含一个正整数 aia_i(1≤ai<10111 \leq a_i < 10^{11})。

输出格式

Print n lines. The i-th of them should contain a positive integer k__i such that the last min(100, length(2_k__i_)) digits of 2_k__i_ contain the decimal notation of a__i as a substring. Integers k__i must satisfy 1 ≤ k__i ≤ 1050.

It can be shown that the answer always exists under the given constraints. If there are multiple answers, print any of them.

输出 n 行。其中第 i 行应包含一个正整数 k__i,使得 2ki2^{k_i} 的末尾 min⁡(100, length(2ki))\min(100,\ \text{length}(2^{k_i})) 位数字中,包含 a__i 的十进制表示作为一个子串。整数 k__i 必须满足 1 ≤ ki ≤ 10501\ \le\ k_i\ \le\ 10^{50}。

在给定约束下,可以证明答案一定存在。如果存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    2
    8
    2

    输出#1

    3
    1
  • 输入#2

    2
    3
    4857

    输出#2

    5
    20

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

首页