1. Erste Version: C, Evgeni Pavlidis


/**
* ACM programming Contest WS 08/09
* UVa Status: accepted
* Run Time: 0.030
* @author Evgeni Pavlidis evgenipavlidis@yahoo.de
*/

#include <stdio.h>

#define MAX 30000
#define COINS 5

int coins[] = {50, 25, 10, 5, 1};

long long nway[MAX+1];

int n = 30000,i,j,c,d;

int main()
{
nway[0] = 1;

for(i=0; i < COINS; i++)
{
c = coins[i];
for(j=c; j <= n; j++)
nway[j] += nway[j-c];
}

while(1)
{
scanf("%d\n", &n);
if(nway[n] == 1)
printf("There is only 1 way to produce %d cents change.\n", n);
else
printf("There are %lld ways to produce %d cents change.\n", nway[n], n);

if(feof(stdin))
return 0;
}
}