UVA 591 - Box of Bricks

UVA Sep 1, 2020

Problem PDF

Solution:

#include
int main()
{
int n,i,a[100],t=1,sum,c;
while(scanf("%d",&n)==1 && n!=0)
{
  sum=0;
  c=0;
    for(i=0;isum)
    c=c+(a[i]-sum);
    printf("Set #%d\nThe minimum number of moves is %d.\n\n",t++,c);
}
return 0;
}
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/591/591.cpp

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.