js里算法与数据结构认证项目第五题计算找零输出和应该输出的一样但是错了,有没有大佬知道为什么?

const type = [["PENNY",0.01],["NICKEL",0.05],["DIME",0.1],["QUARTER",0.25],["ONE",1],["FIVE",5],["TEN",10],["TWENTY",20],["ONE HUNDRED",100]];
const type2 = [["PENNY",0.01],["NICKEL",0.05],["DIME",0.1],["QUARTER",0.25],["ONE",1],["FIVE",5],["TEN",10],["TWENTY",20],["ONE HUNDRED",100]];
function checkCashRegister(price, cash, cid) {
    let change={
        change:[],
        status:""
    };
    let giveChange = (cash - price)*100;
    let total = 0;
    for (const num of cid) {
        total+=num[1]*100;
    }
    if (giveChange == total) {
        change.status = "CLOSED";
        change.change = cid;
        return change;
    }
    if (giveChange > total) {
        change.status = "INSUFFICIENT_FUNDS";
        return change;
    }
    for (let i = type.length-1,n=0; i >= 0; i--) {
        type[i][1]=Math.ceil(type[i][1]*100);
        type2[i][1]=Math.ceil(type2[i][1]*100);
        cid[i][1]=Math.ceil(cid[i][1]*100);
        while (giveChange >= type[i][1] && cid[i][1] != 0) {
            if(change.change[n]){
                change.change[n][1]+=type[i][1];
                cid[i][1]-=type[i][1];
                giveChange-=type[i][1];
            }else{
                change.change.push(type2[i]);
                cid[i][1]-=type[i][1];
                giveChange-=type[i][1];
            }
        }
        if (change.change[n]) {
            change.change[n][1]/=100;
            n++; 
        }
    }
    if (giveChange!=0) {
        change.status = "INSUFFICIENT_FUNDS";
        return change;
    }
    change.status = "OPEN";
    return change;
  }
  
console.log(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]));

上面是我的代码
下面是应该输出的结果
1635325068(1)
这个是我的输出结果
1635325094(1)
跪求原因(;´д`)ゞ

谢谢各位了,我已经解决这个问题了 :grin: