题解:CF2132B The Secret Number
洛谷CF2132B || CodeForces 2132 B
简要题意
对一个数
思路
注意到
如果最后发现数组内无元素,代表无解,记得输出
#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;
}
}