uva-online-judge icon indicating copy to clipboard operation
uva-online-judge copied to clipboard

Question

Open ptoledor opened this issue 3 years ago • 2 comments

for(int i=0; i<nc; i++){
    if(**nc-1 == i** || curSum+coins[i] < coins[i+1]){
        curSum += coins[i];
        res++;
    }
}   
cout << res << endl;

}

whats the logic behing "nc-1 == i" thanks

ptoledor avatar Aug 20 '20 23:08 ptoledor