Quick Change
Time Limit: 1000MS |
|
Memory Limit: 65536K |
Total submissions: 6111 |
|
accepted: 4358 |
Description
J.P. Flathead ' s grocery Store hires cheap labor to man the checkout stations. The people he hires (usually high school kids) often make mistakes making to the customers. Flathead, who's a bit of a tightwad, figures he loses the more money from this mistakes than he makes; That's, the employees tend to give, the customers than they the should get.
Flathead wants to write a program that calculates the number of quarters ($0.25), dimes ($0.10), nickels ($0.05) and P ENnies ($0.01) that's the customer should get back. Flathead always wants to give the customer's change in coins if the amount due-back are $5.00 or under. He also wants to give the customers back the smallest total number of coins. For example, if it is $1.24, the customer should receive 4 quarters, 2 dimes, 0 nickels, and 4 pennies.
Input
The "a" of input contains an integer N which was the number of datasets that follow. Each dataset consists to a single line containing a single integer which was the change due in cents, C, (1≤ C ≤500).
Output
For each dataset, print out of the dataset number, a space, and the string :
Q quarter (s), D DIME (s), n nickel (s), P PENNY (s)
Where Q is him number of quarters, D is the number of Dimes, N is the number of nickels and P is the number of pennies.
Sample Input
3
124
194
Sample Output
1 4 quarter (s), 2 dime (s), 0 nickel (s), 4 penny (s)
2 1 quarter (s), 0 DIME (s), 0 nickel (s), 0 penny (s)
3 7 Quarter (s), 1 DIME (s), 1 nickel (s), 4 PENNY (s)
Source Greater New York 2006 You left, my world is left with rain ...
#include <stdio.h>
int main ()
{
int n,c,q,d,x;
int i;
scanf ("%d", &n);
for (i = 1; I <= n; i++)
{
q = 0, d = 0, x = 0;
scanf ("%d", &c);
Q = C/25;
c = c%;
d = C/10;
c = c%;
x = C/5;
c = c% 5;
printf ("%d%d quarter (s),%d DIME (s),%d nickel (s),%d PENNY (s) \ n", I, Q, D, X, c)
;
return 0;
}