in this problem given radious of a circle
So,Circle area=pi*r*r
So,Square area=4*r*r
Shadow area=Sqare area-Circle area
N.B:Plesae print after 2 decimal print(Use C for this)
///Bismillahir Rahmanir Rahim
///Author:Tanvir Ahmmad
///CSE,Islamic University,Bangladesh
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<vector>
#include<iterator>
#include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array
/*every external angle sum=360 degree
angle find using polygon hand(n) ((n-2)*180)/n*/
///Floor[Log(b) N] + 1 = the number of digits when any number is represented in base b
using namespace std;
typedef long long ll;
typedef long long unsigned llu;
double pi = 2 * acos (0.0);
int main()
{
int tst,n;
scanf("%d",&tst);
for(ll i=1;i<=tst;i++)
{
double num;
cin>>num;
//cout<<"Case 1: <<
printf("Case %d: %.2f\n",i,(4*num*num)-(pi*num*num));
}
return 0;
}
///Alhamdulillah
Problem Link:https://lightoj.com/problem/circle-in-square
Comments
Post a Comment