Problem link:
Practice
Contest link
Author: Ujjawal Gupta
Tester: Ayush Srivastava
Editorial: Ujjawal Gupta
Difficulty:
Easy
Prerequisite:
Basic Mathematics.
Problem Statement :-
You have to fill the maximum region of plot with the tiles without breaking tiles, no portion of tiles is outside the plot & the length of tiles must be parallel to the hypoteneous of the right angle triangle shaped plot.
Algorithm :-
The maximum tiles is possible when tiles is place adjacent to each other in each layer.
There are total (hieght of triangle/b) layers possible .
From bottom layer to top layer, No. of tiles decreasing as area of each layer decreases.
Solution:-
Setter's Code
#include <iostream>
#define ll long long
using namespace std;
//Execution of logical function.
ll func(ll hypo,ll l,ll b){
ll i,j,k,m,n,o,count=0;
while(hypo/2>b){
count+=(hypo-2*b)/l;
hypo=hypo-2*b;
}
return count;
}
//Execution of Main function.
int main() {
ll hypo,l,b;
cin>>hypo>>l>>b;
cout<<func(hypo,l,b);
// your code goes here
return 0;
}