#include <stdio.h>
#include <math.h>
int r1, r2;
void setR()
{
char ch;
int n;
while (ch = getchar())
{
if (ch == ' ') break;
if (ch == '\n'){ r2 = -1; return; }
r1 = r1 * 10 + ch - '0';
}
while (ch = getchar())
{
if (ch == '\n') return;
r2 = r2 * 10 + ch - '0';
}
}
int main()
{
double PI = 2 * acos(0.0);
int n;
scanf("%d", &n);
getchar();
while (n --)
{
r1 = 0, r2 = 0;
setR();
if (r2 != -1)
printf("%.4f\n", (double)((r1 + r2) * (r1 + r2) - r1 * r1 - r2 * r2) * PI );
else
printf("%.4f\n", (PI * (double)(r1 * r1)) / 8);
}
return 0;
}
回目錄
回首頁
沒有留言 :
張貼留言