Skip to content

Instantly share code, notes, and snippets.

@pogin503
Created December 19, 2011 15:11
Show Gist options
  • Save pogin503/1497607 to your computer and use it in GitHub Desktop.
Save pogin503/1497607 to your computer and use it in GitHub Desktop.
TopCoder SRM 152 DIV2 250pt
#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