Page 5 of 6

Re: 591

Posted: Tue Sep 07, 2010 8:57 pm
by faiem
"Output a blank line after each set."
Read this Carefully...its a problem about input/Output...

ur Output should look like.......

6
5 2 4 1 7 5
Set #1
The minimum number of moves is 5.

4
5 10 3 2
Set #2
The minimum number of moves is 5.

0


Wish ur best luck....

Re: 591

Posted: Sat Sep 11, 2010 1:05 pm
by valkov
faiem wrote:why u r sorting???
it is possible without sorting...and very fast...
Yes. You are right, no sorting is needed :)

591 - Box of Bricks

Posted: Fri Dec 02, 2011 1:35 pm
by tzupengwang
could anyone tell me why I got WA??
the following is my source code.
/*591*/
#include<stdio.h>
#include<string.h>
int main()
{
int k,a;
for(k=1;scanf("%d",&a)==1;k++)
{if(!a)break;
int str[a],i;
for(i=0;i<a;i++)
{scanf("%d",&str);}
int sum,aver,m;
for(i=0,sum=0;i<a;i++)
{sum+=str;}
aver=sum/a;
for(i=0,sum=0;i<a;i++)
{if(aver>str){m=aver-str;
sum+=m;}
}
printf("Set #%d\n",k);
printf("The minimum number of moves is %d.\n",sum);
}
return 0;
}

Re: 591-Box of bricks

Posted: Fri Dec 02, 2011 1:38 pm
by tzupengwang
I tried several times and it went well,
could anyone help me?
THANKS~

Re: 591-Box of bricks

Posted: Fri Dec 02, 2011 1:53 pm
by uvasarker
print double new line such as mine:
printf("Set #%d",c);

printf("\nThe minimum number of moves is %d.\n\n",q);

Re: 591-Box of bricks

Posted: Fri Dec 02, 2011 2:05 pm
by tzupengwang
Thanks a lot~
Finally AC after 2 WAs.

Re: 591-Box of bricks

Posted: Sat May 19, 2012 12:48 am
by enamsustcse
Thanx a lot,,
I have just mistaken it for last several attepmts...
but now.. :D

591 Box of Bricks

Posted: Thu Jan 24, 2013 2:55 pm
by xtine.m
Can anyone tell me why I got a Time Limit Exceeded?

Re: 591 Box of Bricks

Posted: Thu Jan 24, 2013 9:43 pm
by brianfry713
Try running your code on the sample input.
Change line 13 to:
while (scanf("%d",&c) == 1 && c != 0) {

Re: 591 Box of Bricks

Posted: Fri Jan 25, 2013 1:57 pm
by xtine.m
Thank you! just deleted my codes.. Just got accepted!!

591 - Box of bricks

Posted: Mon Jun 10, 2013 10:57 pm
by winnfield
SOLVED

NOTHING TO SEE HERE

Re: 591 - Box of bricks

Posted: Tue Jun 11, 2013 2:19 am
by brianfry713
print minimum not minumum

Re: 591 - Box of bricks

Posted: Tue Jun 11, 2013 4:59 am
by winnfield
brianfry713 wrote:print minimum not minumum
I feel so stupid right now...

591 - Box Of Bricks (WA)

Posted: Mon Jul 07, 2014 8:11 pm
by milseg
Hello! I've tested this problem with a lot of inputs and it seems like i get correct answers. Tough it isn't working in the submission system, cause it raises wrong answer. Could someone tell me where is the error on my Source Code. Here it is:

Code: Select all

DELETED

Re: 591 - Box Of Bricks (WA)

Posted: Tue Jul 08, 2014 2:21 am
by brianfry713
Don't use a set.
Input:

Code: Select all

4
1 1 3 3
0
AC output:

Code: Select all

Set #1
The minimum number of moves is 2.