SRM467 Div2 250 ShorterSuperSum

Div1 500 SuperSumの簡単バージョン.kもnも14以下.
無駄にメモ再帰で書いてみた.

#include <iostream>

using namespace std;

class ShorterSuperSum{
private:
    int mem[15][15];
public:
    int calculate(int k, int n, bool call = true){
        if(call) memset(mem, -1, sizeof(mem));
        if(k == 0) return n;
        if(mem[k][n] != -1) return mem[k][n];
        int res = 0;
        for(int i=1;i<=n;i++)
            res += calculate(k-1, i, false);
        return mem[k][n] = res;
    }
};