1.
/* Angewandte Mathematik, SS09, IFB 2C 
* ACM Problem #357 (Let Me Count The Ways)
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=5&page=show_problem&problem=293
*
* @author Dennis Wilfert

* @version 1.0, 07/02/2009
*
* Status : Accepted
* Runtime: 0.228
*/
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class Main {

public static void main(String[] args) throws IOException {
StringBuilder output = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter p = new PrintWriter(new BufferedOutputStream(System.out));
int[] coin = new int[]{50, 25, 10, 5, 1};
// Betrag als Integerwert in cent
int amount;
// Kombinationsmöglichkeiten für die verschiedenen Beträge
long[] nway = new long[30001];
// Zahl als String
String string;
// Hilfsvariablen
int c, i, j;
nway[0] = 1;
// Sämtliche Kombinationen für alle Beträge von 0 cent bis 30000 cent berechnen
for(i=0; i<coin.length; i++){
c = coin[i];
for(j = c; j<=30000; j++)
nway[j] += nway[j-c];
}
while(true){

string = reader.readLine();

if(string == null)break;
// Betrag als int-Wert
amount = Integer.parseInt(string);

if(nway[amount]==1){
output.append("There is only 1 way to produce ");
output.append(amount);
output.append(" cents change.\n");
}
else{
output.append("There are ");
output.append(nway[amount]);
output.append(" ways to produce ");
output.append(amount);
output.append(" cents change.\n");
}
}
p.print(output);
p.flush();
}

}
2.

/*

 * ACM Programming Contest

 * Problem: /*

 * ACM Programming Contest

 * Problem: 357 (Let me count the ways)

 * Status: Accepted

 * Language: ANSI C

 * Runtime: 0.008

 * Date: 2009-05-27 12:56:39

 * Author: Andreas Kunft

 */



#include <stdio.h>

#include <string.h>



#define MAXTOTAL 30001

#define COINS 5



long long nway[MAXTOTAL];



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



int main() {

    int i, j, n, c;

    nway[0] = 1;

    for (i=0; i< COINS; i++) {

        c = coin[i];

        for (j=c; j< MAXTOTAL; j++)

            nway[j] += nway[j-c];

    }



    while (scanf("%d",&n) == 1) {

        if (nway[n] > 1)

            printf("There are %lld ways to produce %d cents change.\n", nway[n], n);

        else

            printf("There is only 1 way to produce %d cents change.\n", n);

    }

    return 0;

}