You are viewing a single comment's thread. Return to all comments →
just check it
int main() {
int a,b,c,i;
cin>>a>>b>>c; int d[a],e[b],f[c]; long long int x=0,y=0,z=0; for(i=0;i<a;i++) { cin>>d[i]; x=x+d[i]; } for(i=0;i<b;i++) { cin>>e[i]; y=y+e[i]; } for(i=0;i<c;i++) { cin>>f[i]; z=z+f[i]; } int p=0,q=0,r=0; while(x!=y ||y!=z ||x!=z) {if(x>y && x>z|| x==y && x>z || x==z &&x>y) x=x-d[p++]; if(y>x && y>z|| y==x && y>z || y==z &&y>x) y=y-e[q++]; if(z>x &&z>y || z==y && z>x || z==x &&z>y) z=z-f[r++]; } cout<<x; return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
just check it
int main() {
int a,b,c,i;
}