12611 - 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}

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;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值