Artifact Content
Not logged in

Artifact ec3c7b925e5f4d41117bc3f12ccac0110e724566


#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;

class FoxMakingDice { public:
	long long theCount(int N, int K) 
	{
		LL cnt = 0;
		for(int sum=K; sum<=N+N; ++sum)
		{
			LL v = 0;
			for(int s=1; s<=N; ++s)
				if( s<sum-s && 1<=sum-s && sum-s<=N )
					++v;
			cnt += v*(v-1)*(v-2)/6*2;
		}
		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 long long& Expected, const long long& 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(_, FoxMakingDice().theCount(N, K));}
int main(){

CASE(0)
	int N = 6; 
	int K = 7; 
	long long _ = 2LL; 
END
CASE(1)
	int N = 5; 
	int K = 7; 
	long long _ = 0LL; 
END
CASE(2)
	int N = 1000; 
	int K = 1; 
	long long _ = 20625666000LL; 
END
CASE(3)
	int N = 456; 
	int K = 123; 
	long long _ = 879075732LL; 
END
CASE(4)
	int N = 913; 
	int K = 1014; 
	long long _ = 4506149340LL; 
END
CASE(5)
	int N = 1000; 
	int K = 2000; 
	long long _ = -1LL; 
END
CASE(6)
	int N = 1; 
	int K = 7; 
	long long _ = 0LL; 
END
CASE(6)
	int N = 2; 
	int K = 7; 
	long long _ = 0LL; 
END
CASE(6)
	int N = 3; 
	int K = 7; 
	long long _ = 0LL; 
END
CASE(6)
	int N = 4; 
	int K = 7; 
	long long _ = 0LL; 
END
CASE(6)
	int N = 5; 
	int K = 7; 
	long long _ = 0LL; 
END

}
// END CUT HERE