Skip to content

Instantly share code, notes, and snippets.

@jongyeol
Created March 6, 2012 18:08
Show Gist options
  • Save jongyeol/1987851 to your computer and use it in GitHub Desktop.
Save jongyeol/1987851 to your computer and use it in GitHub Desktop.
Template of srm523
// Topcoder SRM 523 template
// problem: http://community.topcoder.com/stat?c=problem_statement&pm=10957&rd=14548
#include <iostream>
#include <cstdio>
using namespace std;
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
// cut here start -------------------------------------------------------------
class CountingSeries {
public:
long long countThem(long long a, long long b, long long c, long long d, long long upper) {
// TODO
return 0;
}
};
// cut here end ---------------------------------------------------------------
static long long D[][6] = {
{1, 1, 1, 2, 1000, 1000},
{3, 3, 1, 2, 1000, 343},
{40, 77, 40, 100000, 40, 1},
{452, 24, 4, 5, 600, 10},
{234, 24, 377, 1, 10000, 408},
};
int main() {
CountingSeries c;
for (int i = 0; i < ARRAY_SIZE(D); i++) {
long long out = c.countThem(D[i][0], D[i][1], D[i][2], D[i][3], D[i][4]);
printf("#case %d: a=%lld, b=%lld, c=%lld, d=%lld, upper=%lld\n",
i, D[i][0], D[i][1], D[i][2], D[i][3], D[i][4]);
printf("(expect) %lld\n(output) %lld\n(result) %s\n\n",
D[i][5], out, (D[i][5] == out ? "[SUCCESS]" : ""));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment