就是对取余的模拟
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
char str[1001];
cin >> n;
int p = 0;
int now = 1;
int len = 0;
while (true) {
if(p || now / n) {
str[p++] = '0' + now / n;
}
len++;
now %= n;
if (now == 0)
{
str[p] = 0;
cout << str << " " << len << endl;
break;
}
now = now * 10 + 1;
}
return 0;
}