Artifact Content
Not logged in

Artifact e1aea37918978601680b5b0a1cf499508d55881c


#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

static const int MODVAL = 1000000007;

class GuessTheNumberGame { public:
	int possibleClues(int n) 
	{
		vector<bool> isPrime(n+1, true);
		vector<int> ps;
		for(LL p=2; p<=n; ++p)
			if( isPrime[p] ) {
				ps.push_back(p);
				for(LL q=p*p; q<=n; q+=p)
					isPrime[q] = false;
			}

		LL cnt = 1;
		for(int i=0; i<ps.size(); ++i)
		{
			LL p = ps[i];
			LL k = 1, pk = p;
			while( pk*p <= n )
				pk*=p, k++;
			cnt = cnt*(k+1) % MODVAL;
		}
		return cnt;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, GuessTheNumberGame().possibleClues(n));}
int main(){

CASE(0)
	int n = 5; 
	int _ = 12; 
END
CASE(1)
	int n = 16; 
	int _ = 240; 
END
CASE(2)
	int n = 1; 
	int _ = 1; 
END
CASE(3)
	int n = 1000000; 
	int _ = 677298706; 
END
CASE(4)
	int n = 10000000; 
	int _ = -1; 
END
CASE(5)
	int n = 1; 
	int _ = 1; 
END
CASE(6)
	int n = 6; 
	int _ = 12; 
END
CASE(7)
	int n = 7; 
	int _ = 24; 
END
CASE(8)
	int n = 8; 
	int _ = 32; 
END

}
// END CUT HERE