Monday, September 12, 2016

UVa 12256 - Making Quadrilaterals

// UVa 12256 - Making Quadrilaterals

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	unsigned long long sol[61];
	sol[1] = 1;
	sol[2] = 1;
	sol[3] = 1;
	for (int i = 4; i < 61; i++)
		sol[i] = sol[i - 1] + sol[i - 2] + sol[i - 3];
	int n, t = 0;
	while ((cin >> n) && n) {
		t++;
		printf("Case %d: %llu\n", t, sol[n]);
	}
	return 0;
}

No comments:

Post a Comment