搜索小练#5
#include <cstdio>
#include <iostream>
#define ull unsigned long long int
using namespace std;
int n, k;
inline void dfs (ull ans, int n, int weishu) {
if (k == 0) return;
if (weishu == 20) return;
if (ans%n == 0) {
cout << ans << '\n';
k = 0;
return;
}
dfs (ans*10, n, weishu+1);
dfs (ans*10+1, n, weishu+1);
}
int main () {
while (scanf ("%d", &n)&& n != 0) {
k = 1;
dfs (1, n, 1);
}
return 0;
}
this is a easy topic
but I can not make it unless I can read the answer
To tell the truth, I was very terrible
Although the topic is easy but I don't know how to solve it
I will also try my best to welcome the NOIP2020.
PS:
1.we need the 'weishu == 20'
because the ull can held '19' so we much let the ull can search all

浙公网安备 33010602011771号