ACM (UVa) : 674


#include <stdio.h>

long ways [7500];
void count ()
{
	
	int coin [] = { 50, 25, 10, 5, 1 };

	ways [0] = 1;

	for ( int i = 0; i < 5; i++ ) {
		for ( int j = coin [i]; j < 7500; j++ )
			ways [j] += ways [j - coin [i]];
	}
}

int main ()
{
	count ();
	int n;
	while ( scanf ("%d", &n) != EOF )
		printf("%ld\n", ways [n]);

	return 0;

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s