P1530 调了好久 30分
#include<bits/stdc++.h>
using namespace std;
struct node{
bool nm;
int pos;
};
node xb[11];
int num[10000010];
signed main(){
ios::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
long long a,b,k=0,j;
cin>>a>>b;
k=a%b;
cout<<a/b;
// while(k){
j=2;
num[1] = -1;
while(k){
k*=10;
num[j]=k/b;
j++;
k%=b;
if(xb[k].nm<1){
xb[k].nm = 1;
xb[k].pos = j;
}
else {
num[1]=xb[k].pos;
break;
}
}
// }
if(num[1]==-1){
cout<<".";
for(int i=2;i<j;i++){
cout<<num[i];
}
} else{
cout<<".";
for(int i=2;i<j;i++){
if(i == num[1]) cout << '(';
cout<<num[i];
}
cout << ')';
}
return 0;
}