A11516 | Power Substring
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The first line contains a single integer $n$ ( $1<=n<=2000$ ) — the number of integers $a_{i}$ .
Each of the next $n$ lines contains a positive integer $a_{i}$ ( $1<=a_{i}<10^{11}$ ).
Each of the next $n$ lines contains a positive integer $a_{i}$ ( $1<=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}<=10^{50}$ .
It can be shown that the answer always exists under the given constraints. If there are multiple answers, print any of them.
It can be shown that the answer always exists under the given constraints. If there are multiple answers, print any of them.
输入输出样例
输入 #1
2 8 2
输出 #1
3 1
输入 #2
2 3 4857
输出 #2
5 20
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted