Beautiful Flag
Beautiful Flag |
Teering is a little boy. He is trying to draw the nationalflag of Bangladesh. Being smart he knows he has to maintain the correct ratioand measurement while drawing the flag. You know the rules of drawing the nationalflag, don't you? If not, no worries, Teering is here to help you:
The national flag of Bangladesh consist of a greenrectangle with a red circle inside it. The ratio of the length and width of therectangle is 100 : 60 (i.e. if thelength is 100 units then the width willbe 60 units). The radius of the circle is 20%of the length (i.e. if the length is 100 units then the radius of the circlewill be 20 units). To get the center of the circle you need to draw ahorizontal line dividing the width inequal portion and draw a vertical line dividing the length in 45 : 55 ratio (i.e. if the length of the rectangle is 100then 45 units will be in left and 55 units will be on the right side of theline). The crossing of the two lines will be the center of the circle. Here isan illustrated picture for better understanding.
![\epsfbox{p12611.eps}](http://uva.onlinejudge.org/external/126/p12611.jpg)
Now Teering has started to draw a flag. He has alreadydrawn the circle of radius R centeredat the origin in a 2D co-ordinatesystem. Now he needs to determine the corner of the rectangle so that he canjoin them to complete the flag. Can you help him?
Input
The first line of input will contain an integer T (T < 101) denotingthe number of test cases. Each of the following T lines will contain an integer R (R < 1001) each denotingthe radius of the circle.
Output
For each input output five lines. The first line willcontain the case number. The following four lines will denote the upper left, upper right, lower rightand lower left coordinates of therectangle for the flag respectively. You have to print x coordinate and ycoordinate separated by space in each line. You may assume that input is givenin such that the corners will always bein integer coordinates. See sample input output for details.
Sample Input
2 20 100
Sample Output
Case 1: -45 30 55 30 55 -30 -45 -30 Case 2: -225 150 275 150 275 -150 -225 -150
#include<stdio.h>
int main()
{
int t,count=1;
scanf("%d",&t);
while(t--)
{
int n,x,xx,y;
scanf("%d",&n);
x=5*n/20*9;
xx=5*n/20*11;
y=5*n*6/10/2;
printf("Case %d:\n",count++);
printf("-%d %d\n%d %d\n%d -%d\n-%d -%d\n",x,y,xx,y,xx,y,x,y);
}
return 0;
}