About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

সোমবার, ৭ এপ্রিল, ২০১৪

UVA : 591 - Box of Bricks

#include <iostream>
#include <cstdio>
using namespace std ;
int main (){
    int test,i,a[106],sum,ans,ave,c=0;

    while(scanf("%d",&test)==1){
        if(test==0)break;
        sum=0;ans=0;c++;
        for(i=1;i<=test;i++){
            scanf("%d",&a[i]);
            sum+=a[i];

        }
        ave=sum/test;
        for(i=1;i<=test;i++){
            if(a[i]<ave){

                ans+=(ave-a[i]);
            }
        }
       
        printf("Set #%d\nThe minimum number of moves is %d.\n\n",c,ans);

    }




return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন