Quick Change


Time Limit: 2 Seconds      Memory Limit: 65536 KB

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 change for the customers. Flathead, who's a bit of a tightwad, figures he loses more money from these mistakes than he makes; that is, the employees tend to give more change to the customers than they should get.

Flathead wants you to write a program that calculates the number of quarters ($0.25), dimes ($0.10), nickels ($0.05) and pennies ($0.01) that the customer should get back. Flathead always wants to give the customer's change in coins if the amount due back is $5.00 or under. He also wants to give the customers back the smallest total number of coins. For example, if the change due back is $1.24, the customer should receive 4 quarters, 2 dimes, 0 nickels, and 4 pennies.

Input

The first line of input contains an integer N which is the number of datasets that follow. Each dataset consists of a single line containing a single integer which is the change due in cents, C, (1 <= C <= 500).

Output

For each dataset, print out the dataset number, a space, and the string:

Q QUARTER(S), D DIME(S), n NICKEL(S), P PENNY(S)

Where Q is he 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
25
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)

 #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int c;
int q, d, n, p, m;
cin >> c;
for(int i = ; i <= c; i++){
cin >> m;
q = m / ;
m = m % ;
d = m / ;
m = m % ;
n = m / ;
p = m % ;
printf("%d %d QUARTER(S), %d DIME(S), %d NICKEL(S), %d PENNY(S)\n", i, q, d, n, p);
}
return ;
}

zoj 2772 Quick Change的更多相关文章

  1. POJ 3085 - Quick Change

    Quick Change Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6288   Accepted: 4468 Desc ...

  2. Making the Elephant Dance: Strategic Enterprise Analysis

    http://www.modernanalyst.com/Resources/Articles/tabid/115/ID/2934/categoryId/23/Making-the-Elephant- ...

  3. macbook pro install ubuntu

    https://help.ubuntu.com/community/MacBookPro Determine your hardware revision To determine which ver ...

  4. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  5. UVALive 7352 Dance Recital

    题意: 有n种舞蹈要跳 每种舞蹈需要每一行字符串所对应的那些人 如果一个人连着跳两个舞蹈 那么需要一个quick change 问需要的最少quick changes是多少 思路: 假期的题 又拿出来 ...

  6. Making every developer more productive with Visual Studio 2019

    Today, in the Microsoft Connect(); 2018 keynote, Scott Guthrie announced the availability of Visual ...

  7. ACM Dance Recital(dfs+剪枝)

    The Production Manager of a dance company has been tasked with determining the cost for the seasonal ...

  8. How To Install Apache Tomcat 7 on CentOS 7 via Yum

    摘自:https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-centos-7-via-y ...

  9. Using APIs in Your Ethereum Smart Contract with Oraclize

    Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...

随机推荐

  1. AJPFX总结heap和stack有什么区别?

    栈是后进先出的线性表结构,存取速度比堆快.创建对象的时候new一个对象,引用存在栈上具体的内容存在堆上. 栈与堆都是Java用来在RAM中存放数据的地方.与C++不同,Java自动管理栈和堆,程序员不 ...

  2. re正则表达式公式讲解3

    1.分组匹配    用()把需要分组的类型括起来,如下 import re m = re.search("([a-z]+)([0-9]+)","alex123" ...

  3. P1967 货车运输 未完成

    #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #inclu ...

  4. IE8 window.open 不支持此接口 的问题解决

    在使用vs2010调试代码时,突然出现 window.open 不支持此接口的提示,开始认为是不是vs的问题,后来上网查询说是系统问题.我不想重装系统,之后发现是IE的问题,使用其他浏览器浏览系统不会 ...

  5. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 忘记mysql密码

    [root@mysql-db03 ~]# mysql -uroot -poldboy123Warning: Using a password on the command line interface ...

  6. 管道命令和xargs的区别(经典解释) 自己的总结

    1. 简介 之所以能用到这个命令,关键是由于很多命令不支 持|管道来传递参数,而日常工作中有有这个必要, 所以就有了xargs命令,例如:find /sbin -perm +700 |ls -l 这个 ...

  7. 7-Java-C(小题答案)

    1:58497 2:171700 3:145 4:i + j+2 == k+1 || i + k+2 == j+1 || k + j+2 == i+1 5:s + " " + (c ...

  8. Image Is Everything LA2995

    白书第一章例题6 构造.思维.几何. 分别从几个角度去看,有矛盾就删掉,最后遍历一下统计个数 方法证明:第一个方块肯定要删除.假设前k个必须删除,第k+1个矛盾出现,假如不删掉,矛盾将持续存在,故必须 ...

  9. postman设置环境变量、全局变量

    讲postman环境变量设置之前,先讲一个小插曲,环境变量.全局变量的区别在于Globals,只能用一组,而Environmen可以设置多组,所以我更喜欢设置环境变量 1.环境变量-Environme ...

  10. qobject_cast

    void QLadderDiagramItem::GetMainForm(DoType sourceType){ for each (QWidget *w in qApp->topLevelWi ...