#include<iostream>
#include<queue>
#include<cstring>
#include<queue>
#include<fstream>
using namespace std;
int n;
queue<long long> q;
long long bfs(int n) {
if(n == 0) return 0;
if(n == 1) return 1;
q.push(1);
long long pre, next;
int i;
while(!q.empty()) {
pre = q.front();
q.pop();
for(i = 0; i < 2; i++) {
if(i == 0) next = pre * 10 + 0;
else next = pre * 10 + 1;
if(next % n == 0) return next;
q.push(next);
}
}
}
int main() {
int i;
ofstream ocout;
ocout.open("test.txt");
for(i = 1; i <=200 ; i++ ) {
while(!q.empty()) {
q.pop();
}
ocout<< '"' << bfs(i) << '"' << ',';
}
ocout.close();
return 0;
}超时。。。超时。。。只好打表
poj 1426
最新推荐文章于 2021-02-20 21:00:32 发布