SOJ-1009(dollars,简单动态规划)

ll s[] = {5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000};
int main()
{
	ll i, j;
	ll d[5005] = {0};
	d[0] = 1;
	for (i = 0; i <= 10; ++i) {
		for (j = 0; s[i] + j <= 5000; ++j)
			d[s[i] + j] += d[j];
	}
	double n;
    while (scanf("%lf", &n) == 1 && (int)(n * 100) != 0)
		printf("%5.2lf%12lld\n", n, d[(int)((n + 0.005) * 100)]);
    return 0;
}

 

你可能感兴趣的:(SOJ-1009(dollars,简单动态规划))