Artifact 7026c83513549f24cd221e6c2be411221a2c38a2
#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 TheNumbersWithLuckyLastDigit { public:
int find(int n)
{
int feasible[10][2] = {
{20, 5}, // 4+4+4+4+4
{11, 2}, // 4+7
{12, 3}, // 4+4+4 (4+4+7+7)
{23, 5}, // 4+4+4+4+7
{ 4, 1}, // 4 (7+7)
{15, 3}, // 4+4+7
{16, 4}, // 4+4+4+4
{ 7, 1}, // 7
{ 8, 2}, // 4+4 (4+7+7)
{19, 4}, // 4+4+4+7
};
if( feasible[n%10][0] <= n )
return feasible[n%10][1];
return -1;
}
};
// 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(_, TheNumbersWithLuckyLastDigit().find(n));}
int main(){
CASE(0)
int n = 99;
int _ = 4;
END
CASE(1)
int n = 11;
int _ = 2;
END
CASE(2)
int n = 13;
int _ = -1;
END
CASE(3)
int n = 1234567;
int _ = 1;
END
CASE(4)
int n = 1;
int _ = 2;
END
CASE(5)
int n = 1000000000;
int _ = -1;
END
}
// END CUT HERE