一
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
cin>>x;
int s=1,size=0,y=0;
while(x>s)
{
s=s*10+1;
size++;
}
do{
cout<<s/x;
y=s%x;
s=y*10+1;
size++;
}while(y!=0);
cout<<" "<<size;
return 0;
}
二
#include<bits/stdc++.h>
using namespace std;
string ans;
int b,y,i,size=1,ok=1;
int main() {
cin>>b;
while(ok)
{
for(i=0;i<size;i++){
ans.push_back((y*10+1)/b+48),y=(y*10+1)%b;
if(i==size-1&&y==0) {
ok=0;
}
if(i==size-1&&y!=0) {
size++;
ans.clear();
y=0;
break;
}
}
}
while(ans[0]=='0') ans.erase(ans.begin(),ans.begin()+1);
cout<<ans<<" "<<size<<endl;
return 0;
}