# ECAPR202 - Editorial

Author: shrivas7
Tester: sandeep1103
Editorialist: shrivas7

CAKEWALK

# PREREQUISITES:

Basic Mathematics

# EXPLANATION:

The square inscribed within a circle will have maximum area when the diagonal of the square will be equal to the diameter of the circle.
Now ,
2a^2 = (diagonal)^2 , where a is side of the square
a^2=((2*R)^2)/2
Therefore Max Area = 2*R*R

O(1)

# SOLUTIONS:

Setter's Solution
``````#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {

ll t,n,r;
cin>>t;
while(t--)
{
cin>>r;
n=(2*r*r);
cout<<n<<endl;
}
return 0;
}
``````
Tester's Solution
``````#include <bits/stdc++.h>
#define ll long long int
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define scanarr(a,b,c) for( i=b;i<c;i++)cin>>a[i]
#define showarr(a,b,c) for( i=b;i<c;i++)cout<<a[i]<<' '
#define ln cout<<'\n'
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define MAX 100005
using namespace std;
////////////////////////////////////////////////////////////////CODE STARTS HERE////////////////////////////////////////////////////////////////

void solve(){
ll n;
cin>>n;
n = 2 * n;
n = n * n;

cout<<n/2<<endl;;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
int t;
cin>>t;
while(t--)
solve();
}
``````
3 Likes