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
-
Maximum running product for a string of numbers
1713 Solvers
-
1217 Solvers
-
438 Solvers
-
297 Solvers
-
Replace Nonzero Numbers with 1
313 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!