SESSION 1:-
In the following figure, you can see a rectangular :-
#include <bits/stdc++.h>
using namespace std;
void solve(){
cout<<"return(l-2*x)*(b-2*x)*x;";
}
int main()
{
int tc;
double a, b, c, res, l, w, x;
scanf(" %d", &tc);
while(tc--) {
scanf(" %lf %lf", &l, &w);
a = 12.0;
b = -4.0 * (l+w);
c = l*w;
x = (-b - sqrt (b*b - 4.0*a*c)) / (2.0*a);
res = (l - 2*x) * (w - 2*x) * x;
printf ("%.9f\n", res);
}
return 0;
}
,Mr. somu has another problem for Agi today.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int b,n,r;
cin>>b>>n>>r;
int z=1;
for(int i=1;i<=n;i++){
z=z*i;
}
int res;
res=pow(b,z);
cout<<res%r<<endl;
}
return 0;
cout<<"if(n%2==1)";
}
, Major Kathiravan has a chart of distinct :-
#include<bits/stdc++.h>
#define f(n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
int res=10000;
f(n){
cin>>arr[i];
}
f(n){
for(int j=i+1;j<n;j++){
if(arr[i]>arr[j]){
res=min(res,arr[i]-arr[j]);
}
}
}
cout<<res;
return 0;
cout<<"while";
In the following figure, you can see a rectangular :-
#include <bits/stdc++.h>
using namespace std;
void solve(){
cout<<"return(l-2*x)*(b-2*x)*x;";
}
int main()
{
int tc;
double a, b, c, res, l, w, x;
scanf(" %d", &tc);
while(tc--) {
scanf(" %lf %lf", &l, &w);
a = 12.0;
b = -4.0 * (l+w);
c = l*w;
x = (-b - sqrt (b*b - 4.0*a*c)) / (2.0*a);
res = (l - 2*x) * (w - 2*x) * x;
printf ("%.9f\n", res);
}
return 0;
}
,Mr. somu has another problem for Agi today.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int b,n,r;
cin>>b>>n>>r;
int z=1;
for(int i=1;i<=n;i++){
z=z*i;
}
int res;
res=pow(b,z);
cout<<res%r<<endl;
}
return 0;
cout<<"if(n%2==1)";
}
, Major Kathiravan has a chart of distinct :-
#include<bits/stdc++.h>
#define f(n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
int res=10000;
f(n){
cin>>arr[i];
}
f(n){
for(int j=i+1;j<n;j++){
if(arr[i]>arr[j]){
res=min(res,arr[i]-arr[j]);
}
}
}
cout<<res;
return 0;
cout<<"while";