题解:我们假设有一段很长的由1组成的序列,such as ”1111111111111111111....“,然后我们模拟除法,当第一次出现余数为0的时候,就是我们要的最小值解
代码:
#include <iostream> #include <queue> #include <cstring> #include <string> #include <cstdio> #include <cmath> using namespace std; int main() { int x; int len=0; char res[1010]; cin>>x; int now=0,pre=0; int flag=0; int cnt=0; while(1) { cnt++; now=pre*10+1;// if(flag !=0 || now/x!=0) { flag=1; res[len++]=now/x+'0'; } pre=now%x; if(pre==0) { res[len]='