同样的代码在IDEA能正常完成需求,在PTA平台却无输出

开始学习的Day15,代码可能繁琐,是顺着自己的思路来的
但同样的代码在IDEA能正常完成需求,在PTA平台却无输出
L1-009(刚开始学习缓慢爬行)
IDEA:

img

PTA

img

代码如下

import java.util.Scanner;
class Main {
    //计算公倍数
    public static int getGbs(int a,int b){
        int t;
        int t1=a;
        int t2=b;
        while(b!=0) {
            t=b;
            b=a%b;
            a=t;
        }
        return (t1*t2)/a;
    }
    //计算公约数
    public static int getGys(int a,int b){
        int t;
        while(b!=0) {
            t=b;
            b=a%b;
            a=t;
        }
        return a;
    }
    public static void main(String[] args) {
        Scanner dx = new Scanner(System.in);
        int num =dx.nextInt();
        Scanner gx=new Scanner(System.in);
        String s =gx.nextLine();
        String[] str =s.split("/| ");
        int[] top =new int[num];
        int[] bottom= new int[num];
        int count =0;
        //记录分子分母 索引一一对应
        for(int i =0;i<str.length;i++) {
            if(i%2==0) {
                top[count]=Integer.parseInt(str[i]);
            } else {
                bottom[count]=Integer.parseInt(str[i]);
                count++;
            }
        }
        int mbottom =1;
        //找到分母的公倍数
        for(int i =0;i<bottom.length;i++) {
            mbottom =getGbs(mbottom,bottom[i]);
        }
        int mtop=0;
        for(int i=0;i<top.length;i++) {
            top[i]=top[i]*(mbottom/bottom[i]);
            mtop+=top[i];
            }
        int temp =getGys(mtop,mbottom);
        mtop/=temp;
        mbottom/=temp;
        int ansnum =0;
        //计算整数部分
        if(mtop<0) {
            int ttop=Math.abs(mtop);
            ansnum=-(int)(Math.floor(ttop/mbottom));
        } else {
            ansnum=(int)(Math.floor(mtop/mbottom));
        }
        int anstop = mtop-ansnum*mbottom;
        String ans ="";
        ans=anstop+"/"+mbottom;
        if(ansnum!=0) {
            ans=ansnum+" "+ans;
        }
        System.out.print(ans);
    }
}

没有一点提示的吗,这种就不好追踪问题了。