求help一题,我的代码和题图如下

#include<bits/stdc++.h>
using namespace std;
int s1,s2,s3,x1,x2,x3;//s容量,x存量
int main(){
cin>>s1>>x1>>s2>>x2>>s3>>x3;
int times=100;
/*
8 2
6 3
12 6*/
while(times--){
// cout<<"x1:"<<x1<<"\nx2:"<<x2<<"\nx3:"<<x3<<"\n";
if(x1>0&&x2<s2){
int trans=x1;
x1-=trans;
x2+=trans;
}
if (x2>0&&x3<s3) {
int trans=x2;
x2-=trans;
x3+=trans;
}
if (x3>0&&x1<s1) {
int trans=x3;
x3-=trans;
x1+=trans;
}
}
cout<<x1<<"\n"<<x2<<"\n"<<x3;
}