I don't understand the output / the problem:
-for 5 there is no answer
-for 10 we can find a box of 2*2*3 inches and so the area is 2*(2*2+2*3+2*3)=32<34
- 26 blocks fit in the solid that contains 27 blocks (area[26]<area[27]) but 82>54.
It seems I don't understand what a solid rectangular means or what area is about.
Please explain! Thanks!
10365 - Blocks
Moderator: Board moderators
i think you misunderstood the problem
first, 5 is the number of test case...
2nd, for 10 blocks, the possible arrangement is 1*1*10 or 1*2*5.
that goes to 26 blocks, which have possible arrangement of 1*1*26 or 1*2*13. For 27 blocks, the possible arrangement is 1*1*27, 1*3*9, and 3*3*3. For each possible arrangement, you have to calculate the wrapping area and find the minimum result.
if you still confused, think about a box which has the volume of n inches^3. Then you have to find the possible height,length, and width of the box which will make an n inches^3 box. (v = h*l*w)
good luck

first, 5 is the number of test case...
2nd, for 10 blocks, the possible arrangement is 1*1*10 or 1*2*5.
that goes to 26 blocks, which have possible arrangement of 1*1*26 or 1*2*13. For 27 blocks, the possible arrangement is 1*1*27, 1*3*9, and 3*3*3. For each possible arrangement, you have to calculate the wrapping area and find the minimum result.
if you still confused, think about a box which has the volume of n inches^3. Then you have to find the possible height,length, and width of the box which will make an n inches^3 box. (v = h*l*w)
good luck

Finding the factors
I got correct answers for sample input but got WA after submission of code.
To find the dimensions of the stack of blocks, I factored the number of blocks with this goal:
F1 * F2 * F3 = Blocks
F1 + F2 + F3 -->> the smallest possible
I used this procedure to find F1, F2 and F3:
My input:
10
9
10
26
27
100
0
1
17
9999
10000
My output:
30
34
82
54
130
0
6
70
4238
2800
To find the dimensions of the stack of blocks, I factored the number of blocks with this goal:
F1 * F2 * F3 = Blocks
F1 + F2 + F3 -->> the smallest possible
I used this procedure to find F1, F2 and F3:
Is my procedure always correct ?Num = Blocks
for n = 1 to 3
..Fn is the biggest number in this range: 1 <= Fn^n <= Num
..Num = Num / Fn
end for
My input:
10
9
10
26
27
100
0
1
17
9999
10000
My output:
30
34
82
54
130
0
6
70
4238
2800
I solve 4 problems per day, then I expend 4 days stuck in a single problem. But I think I'm doing well... ID 37180
check for proper primality tests
what is your output for 1 and 2?
maybe it is helpful.
best of luck.
maybe it is helpful.
best of luck.
hi i am getting wa in this problem
To find smallest (h+l+w) i do ................ like this
is this correct ?????????
plz give some hints...or more test case
any way here is my code
thanks in adv...
To find smallest (h+l+w) i do ................ like this
Code: Select all
long h=1,l=n,w=1;
double d = pow(n,1.0/3.0);
for (long i = d ; i>1 ;i--)
{
if(n%i==0)
{
h=i;l=n/i;
break;
}
}
for (long i = sqrt(l) ; i>1 ;i--)
{
if(l%i==0)
{
w=i;l=l/i;
break;
}
}
plz give some hints...or more test case
any way here is my code
Code: Select all
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
long t;
while(scanf("%ld",&t)==1)
{
for(int j = 0; j< t ;j++)
{
long n ;
scanf("%ld",&n);
if(n==0)
printf("0\n");
else
{
long h=1,l=n,w=1;
double d = pow(n,1.0/3.0);
for (long i = d ; i>1 ;i--)
{
if(n%i==0)
{
h=i;l=n/i;
break;
}
}
for (long i = sqrt(l) ; i>1 ;i--)
{
if(l%i==0)
{
w=i;l=l/i;
break;
}
}
//printf("%ld %ld %ld %lf\n",a,b,c,d);
long r;
r = h*l*2 + h*w*2 + l*w*2;
printf("%ld\n",r);
}
}
}
return 0;
}
thanks in adv...
everything is so hard to me
Try the cases.
Input:
Output:
And just asking..
Is it necessary? You can replace it with
However both should be correct.
Hope these help.
Input:
Code: Select all
3
64
68
76
Code: Select all
96
144
160
Code: Select all
while(scanf("%ld",&t)==1)
Code: Select all
scanf("%ld",&t);
Hope these help.
Ami ekhono shopno dekhi...
HomePage
HomePage
thanks for help ......
i modify my code .... but still wa
is my process correct to compute smallest (h+l+w) ?????????????
here is my modifing code
thankxxxx again

i modify my code .... but still wa

here is my modifing code
Code: Select all
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
long t;
while(scanf("%ld",&t)==1)
{
for(int j = 0; j< t ;j++)
{
long n ;
scanf("%ld",&n);
if(n==0)
printf("0\n");
else
{
long h=1,l=n,w=1,d,h2,l2,w2;
for (long i =1 ; i*i*i<=n ;i++)
d=i;
for (long i =d ; i>1 ;i--)
{
if(n%i==0)
{
h=i;l=n/i;
break;
}
}
l2=l;
for (long i = sqrt(l) ; i>1 ;i--)
{
if(l%i==0)
{
w=i;l=l/i;
break;
}
}
for (long i = sqrt(h) ; i>1 ;i--)
{
if(h%i==0)
{
w2=i;h2=h/i;
break;
}
}
long r1,r2;
r1 = h*l*2 + h*w*2 + l*w*2;
r2 = h2*l2*2 + h2*w2*2 + l2*w2*2;
if(r1>r2)
printf("%ld\n",r2);
else
printf("%ld\n",r1);
}
}
}
return 0;
}
everything is so hard to me
Try n=1 to 10. I don't think your method is correct.
I actually tried all possible ways and picked the best option.
I actually tried all possible ways and picked the best option.
Ami ekhono shopno dekhi...
HomePage
HomePage