专栏文章
题解:CF2132B The Secret Number
CF2132B题解参与者 1已保存评论 0
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mio68b3s
- 此快照首次捕获于
- 2025/12/02 14:02 3 个月前
- 此快照最后确认于
- 2025/12/02 14:02 3 个月前
简要题意
对一个数 进行操作,在其末尾加上若干个 变成数字 ,最后令 。现给出 ,请反解出所有可能的 。
思路
注意到 ,且 ,那么 最大至 。因此我们可以枚举可能的 ,如果存在 为整数则记录下,最后统一输出即可。
如果最后发现数组内无元素,代表无解,记得输出 。
CPP#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll t, n;
int main()
{
cin >> t;
while (t--)
{
cin >> n;
ll a[1005], tot = 0; ll i = 11;
while (n >= i)
{
if (n % i == 0) a[++tot] = n / i;
i = (i - 1) * 10 + 1;
}
cout << tot << endl;
if (tot == 0) continue;
for (int j = tot; j >= 1; j--) cout << a[j] << " ";
cout << endl;
}
}
相关推荐
评论
共 0 条评论,欢迎与作者交流。
正在加载评论...