请各位大佬Debug,解必谢!!!
#include<bits/stdc++.h>
using namespace std;
int main(){
long long x1=0,y1=0,x2=0,y2=1,x;
while(~scanf("%d/%d",&x1,&x2)){
y1=x1*y2+x2*y1,y2=x2*y2;
x=__gcd(y1,y2);
y1/=x;
y2/=x;
}
if(y1<0&&y2<0){
y1=-y1;
y2=-y2;
}else if(y1<0&&y2>0){
y1=-y1;
putchar('-');
}else if(y1>0&&y2<0){
y2=-y2;
putchar('-');
}
if(!y1){
puts("0");
}else if(y2==1){
cout<<y1<<endl;
}else{
cout<<y1<<"/"<<y2;
}
return 0;
}