The national flag of Bangladesh is bottle green in color and rectangular in size with the length (L) to width ratio of 10:6. It bears a red circle on the background of green. It maintains the length (L) to radius ratio of 5:1 (If the length is 10 then width should be 6 and radius should be 2). The color in the background represents the greenery of Bangladesh while the red circle symbolizes the rising sun and the sacrifice of lives in our freedom fight.
Input
First line of input will contain the number of test cases, T ≤ 100. Then there follows T lines, each containing a positive integer L ≤ 1000, representing length of the flag.
Output
For each test case output is a line with two space separated real numbers containing exactly two digits after decimal point. Two numbers represent the area of red and green portion respectively.
Note: Pi is considered to be arccos(−1).
Sample Input
1
10
Sample Output
12.57 47.43
问题链接:UVA12578 10:6:2
问题简述:
孟加拉国的国旗是由绿色长方形和一个红色圆圈构成,长方形长度 (L) 与宽度比为10:6。长方形长度 (L) 与圆半径比为5:1。计算红色与绿色的面积比。
问题分析:
几何计算题,不解释。
程序说明:(略)
题记:(略)
参考链接:(略)
AC的C++语言程序如下:
/* UVA12578 10:6:2 */
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main()
{
int t, l;
double w, r;
scanf("%d", &t);
while(t--) {
scanf("%d", &l);
w = 0.6 * l;
r = 0.2 * l;
printf("%.2f %.2f\n", PI * r * r, w * l - PI * r * r);
}
return 0;
}