Created
December 19, 2011 15:11
-
-
Save pogin503/1497607 to your computer and use it in GitHub Desktop.
TopCoder SRM 152 DIV2 250pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FOR(i,a,b) for(int i=(a);i<(b);++i) | |
class FixedPointTheorem { | |
public: | |
double cycleRange(double R) { | |
double x = 0.25; | |
FOR(i, 0, 200000){ | |
x = R * x * (1 - x); | |
} | |
double min = x, max = x; | |
FOR(i, 200000, 201001){ | |
if(max < x) max = x; | |
if(min > x) min = x; | |
x = R * x * (1 - x); | |
} | |
double result = max - min; | |
return result; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment