题目为 1除3=0.333333 取 3
1除6=0.166666 取 16
1除7=0.142857142857 取142857
#include<vector>
using namespace std;
static long int a,b,a_t,b_t;
static long int c,c_t,c_out;
static int n,flag;
vector <int> t;
vector <int> t_t;
int main()
{
while(1)
{
vector<int>().swap(t);
vector<int>().swap(t_t);
flag=0;
cin>>a>>b;
c=(a*10)/b;
c_t=(a*10)%b;
c_out=c;
t.push_back(c);
t_t.push_back(c_t);
while(c_t)
{
c_t=c_t*10;
a=c_t;
c_t=a%b;
c=a/b;
for(unsigned int i=0;i<t.size();i++)
{
if((t_t[i]==c_t)&&(c==t[i]))
{
flag=1;
}
}
if(flag==1)
{
break;
}
t.push_back(c);
t_t.push_back(c_t);
c_out=c_out*10+c;
}
cout<<c_out<<endl;
}
}