TopcoderArchiveVisit Topcoder
SRM13 Aug 2001
SRM 22

ThreeCentCoin

Problem statement, definition, constraints, and public examples.

Problem Statement

Class Name: ThreeCentCoin
Method Name: getChange
Parameters: int
Returns: int

Imagine a new 3-cent coin were introduced to our economy, revolutionizing how
change was given back to a customer. Create a class called ThreeCentCoin that
includes the method getChange(int) that takes an amount of change (cents) and
returns the minimum number of coins required to make it, using ONLY quarters,
dimes, nickels, the 3-cent coin, and pennies only. Here is the method signature:

public int getChange(int amount);

amount is a positive integer less than 1000.

Examples:
*If amount=9, change can best be given with three 3-cent coins (or a nickel,
penny, and 3-cent coin), and the method returns 3.
*If amount=10, change can be given with a dime, and the method should return 1.
*If amount=100, the method returns 4.
*If amount=898, the method returns 38 (35 quarters, 2 dimes, and 1 3-cent coin).

Definition

Class:
ThreeCentCoin
Method:
getChange
Parameters:
int
Returns:
int
Method signature:
int getChange(int param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems