Skip to content

Instantly share code, notes, and snippets.

@splitline
Created March 16, 2017 09:06
Show Gist options
  • Save splitline/6662c1b3844e0db75dc969f93d122449 to your computer and use it in GitHub Desktop.
Save splitline/6662c1b3844e0db75dc969f93d122449 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sstream>
#include <cmath>
using namespace std;
int main() {
int y;
while(cin >> y){
long long int bits=4*pow(2,(y-1900)/10);
long double max=log10(2)*bits,f,fLog;
cout << max << endl;
for(int i=3;;i++){
f=0;
for(int j=i;j>=1;j--){
f+=log10(j);
if(f>max)break;
}
if(f<=max) fLog=i;
else break;
}
cout << fLog;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment