Food Chain: FODCHAIN


Contributor: Priya (CSE)

link :

A great deal of energy is lost as metabolic heat when the organisms from one trophic level are consumed by the next level.

Suppose in Chefland the energy reduces by a factor of K, i.e, if initially, the energy is X, then the transfer of energy to the next tropic level is ⌊XK⌋. This limits the length of foodchain which is defined to be the highest level receiving non-zero energy.

E is the energy at the lowest tropic level. Given E and K for an ecosystem, find the maximum length of foodchain.

Note: ⌊x⌋ denoted the floor function, and it returns the greatest integer that is less than or equal to x (i.e rounds down to the nearest integer). For example, ⌊1.4⌋=1, ⌊5⌋=5, ⌊−1.5⌋=−2, ⌊−3⌋=−3 , ⌊0⌋=0.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
	ll t;
	    ll E,K;
	    ll ans=1;
	return 0;

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first.