Problem 45338. Area-04
Solution Stats
Problem Comments
-
2 Comments
Asif, Thanks for another nice problem.
I think the description would be improved if it said the "red shaded portion", because there are two shaded portions in the drawing.
The main challenge at this point is solving the problem without the image. The code below illustrates my understanding of the problem, but if you want an added challenge, try figuring out what to compute from the test suite.
clear; close all
figure; hold on
a = 7; b = 2;
t = linspace(0,2*pi); xi = b*cos(t)/2; eta = b*sin(t)/2; indx = find(t>=pi/2 & t<=3*pi/2);
plot([0 a a 0 0],[0 0 b b 0],'k')
plot((a-b)/2+xi,b/2+eta,'k',(a+b)/2+xi,b/2+eta,'k')
fill([0 0 (a-b)/2 (a-b)/2+xi(indx) (a-b/2) 0],[0 b b b/2+eta(indx) 0 0],'r')
axis equal; set(gca,'XTick','','YTick','','XColor','w','YColor','w')
Problem Recent Solvers14
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
8028 Solvers
-
Project Euler: Problem 2, Sum of even Fibonacci
1665 Solvers
-
Back to basics 3 - Temp Directory
358 Solvers
-
1486 Solvers
-
5275 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!