Page 2 of 2

Posted: Thu Jun 07, 2007 1:15 pm
by Jan
Warning : Spoiler Ahead...

Suppose the dimension is 'a x b' and a<=b.
Now, we have two options.

1. We can make an 'a x a' square (since a<=b). And after dividing it into four parts, the length of a square becomes a/2.

2.
i) if(b>=a*4) then we can make four 'a x a' squares. And so, the length of a square is a.
ii) if(b<a*4) then we can make four 'b/4 x b/4' squares. And so, the length of a square is b/4.

Finally, we have to find maximum length from these two options.
Hope it helps.

wa in 0.061 s ---> AC

Posted: Fri Jun 08, 2007 5:28 pm
by adelar
Hi people,
to all inputs in the board my code get ac... but I am with wa in 0.061 s
Something have a critic input to this problem?
Code AC :D
have do too:
0
000

input:
6 4
4 4

output:
1

thanks in advance...

Posted: Sat Jun 09, 2007 1:14 am
by Jan
Read my previous post. It will help you.

Posted: Sat Jul 07, 2007 4:34 pm
by Robert Gerbicz
My program fail only for the following posted input:

Code: Select all

3
1 4
2 6
2 7
For this the posted output is 3. Why isn't 1 ?

For all three rectangles I think the biggest is 4 birds of 1x1 squares. Larger is impossible because 4*2^2=16 is bigger than the rectangle's area.

Posted: Sat Jul 07, 2007 4:42 pm
by hamedv
the largest square for
2 7
is
1.75

Posted: Sat Jul 07, 2007 5:00 pm
by Robert Gerbicz
hamedv wrote:the largest square for
2 7
is
1.75
Thanks! Now I got AC. I thought that all size of the birds are integers.

Posted: Sat Sep 01, 2007 2:11 pm
by sakhassan
I didn't get the idea yet.... Can anyone help me out?

Thanks in advanced

Posted: Mon Jan 14, 2008 4:58 pm
by andmej
Jan wrote:Warning : Spoiler Ahead...

Suppose the dimension is 'a x b' and a<=b.
Now, we have two options.

1. We can make an 'a x a' square (since a<=b). And after dividing it into four parts, the length of a square becomes a/2.

2.
i) if(b>=a*4) then we can make four 'a x a' squares. And so, the length of a square is a.
ii) if(b<a*4) then we can make four 'b/4 x b/4' squares. And so, the length of a square is b/4.

Finally, we have to find maximum length from these two options.
Hope it helps.
Invisible text follows (Spoiler):

Suppose the dimension is 'a x b' and a<=b.

Your way seemed a little over complicated for me. It was easier to think it this way:

The maximum side length given a and b will be MAX( MIN(a, b/4), MIN(a/2, b/2) )

Re: 11207 - The Easiest Way

Posted: Wed Apr 22, 2009 3:35 am
by Pedro
Hello everybody!

Could you put more inputs here?
I tried all inputs posted here and the answers are equals.

thanks

Re: 11207 - The Easiest Way

Posted: Mon Jun 01, 2009 9:44 pm
by saiful_sust
HELLO Pedro

Here r some test cases:
I think this will help u....
INPUT:

Code: Select all

3
11 20000
40 1
12 32167
3
140 12200
122 14000
100 17011
2
120 170213
71 500011
0

OUTPUT:

Code: Select all

3
1
1

Re: 11207 - The Easiest Way

Posted: Sat Oct 15, 2011 7:06 pm
by tamjidahmed
// HI I am tring this problem for 4 daye.....
// can anybody help me...:(



#include<stdio.h>
int main()
{
long long pop,i,ans=0;
double length,wide,temp,reqlength,maxwide;
while(scanf("%lld",&pop)==1)

{
if(pop==0) break;
ans=0;
maxwide=0;
reqlength=0;
for(i=1; i<=pop; i++)
{
scanf("%lf %lf",&wide,&length);
if(length<wide)
{
temp=length;
length=wide ;
wide=temp;
}
if(length==wide)
{
wide=wide/2;
reqlength=length*2;
}
else if(length>=wide*4)
{
wide=wide;
reqlength=wide*4;

}
else
{
if((wide/2)>(length/4))
{
wide=wide/2;
reqlength=wide*2;
}
else
{


wide=length/4;
reqlength=wide*4;
}
}
if(wide>=maxwide)
{

if(wide>maxwide)
{
ans=i;

}
else if(wide==maxwide && length<reqlength)
{
ans=i;
}
maxwide=wide;

}
}
printf("%lld\n",ans);
}

}

Thanks in advance... :D

Re:

Posted: Thu Apr 02, 2015 6:38 am
by robertocsa
jan_holmes wrote:
Try this case..

Code:
2
1 10000
10 10
0


My output is

Code:
2
I'm confuse about this test case. Can anyone explain it to me ? Thx...
The first has one side too small. So the max side of each of the four squares of this line would be 1 (the width of the minor side in a longside cutted paper). For the second line, the result would be 5 (half of the side in a cross cutted paper).

Re: 11207 - The Easiest Way

Posted: Thu Apr 02, 2015 6:43 am
by robertocsa
saiful_sust wrote:
HELLO Pedro

Here r some test cases:
I think this will help u....
INPUT:

Code: Select all

3
11 20000
40 1
12 32167
3
140 12200
122 14000
100 17011
2
120 170213
71 500011
0

OUTPUT:

Code: Select all

3
1
1

My replies are all being the same. I have already tested in others sites (toolkit etc). I am receiving Wrong Answer. I suppose that there is some "formating bug" in my code. Is there any special way to format it?