zoj 2772 Quick Change
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的更多相关文章
- POJ 3085 - Quick Change
Quick Change Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6288 Accepted: 4468 Desc ...
- Making the Elephant Dance: Strategic Enterprise Analysis
http://www.modernanalyst.com/Resources/Articles/tabid/115/ID/2934/categoryId/23/Making-the-Elephant- ...
- macbook pro install ubuntu
https://help.ubuntu.com/community/MacBookPro Determine your hardware revision To determine which ver ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- UVALive 7352 Dance Recital
题意: 有n种舞蹈要跳 每种舞蹈需要每一行字符串所对应的那些人 如果一个人连着跳两个舞蹈 那么需要一个quick change 问需要的最少quick changes是多少 思路: 假期的题 又拿出来 ...
- Making every developer more productive with Visual Studio 2019
Today, in the Microsoft Connect(); 2018 keynote, Scott Guthrie announced the availability of Visual ...
- ACM Dance Recital(dfs+剪枝)
The Production Manager of a dance company has been tasked with determining the cost for the seasonal ...
- 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 ...
- Using APIs in Your Ethereum Smart Contract with Oraclize
Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...
随机推荐
- 16G 手机清理
1.16G 手机清理 清理top 5 的应用的缓存即可 2,hw wife 连接模块 低于 app wifi 的连接模块. 在同样的电脑热点面前,hw 连补上电脑热点,apple 可以连上电脑热点. ...
- 05.NopCommerce给Topic表添加排序及类别字段
在用到Nopcommerce中静态页面表时,发现Topic表没有排序字段和类别字段,导致如果Page文件很多的话,无法区分是哪个类别,为此我稍微扩展了一下字段,在此记录一下操作流程,方便以后自己查看, ...
- js的本质、全局属性
一.js的本质 1.js的本质就是处理数据, 数据来自于后台数据库, 所以变量就起到一个临时数据的作用 Ecmascript 制定了js的数据类型 2.数据类型有哪些? 字符串(string).数字( ...
- TCAM 与CAM
CAM是Content Addressable Memory的缩写,即"内容寻址存储器"的意思,它是在传统的存储技术的基础上实现的联想记忆存储器,关于CAM的基本操作有三种: 1) ...
- Oracle体系结构总览
第一篇 Oracle架构总览 先让我们来看一张图 这张就是Oracle 9i的架构全图.看上去,很繁杂.是的,是这样的.现在让我们来梳理一下: 一.数据库.表空间.数据文件 1.数据库 数据库是数 ...
- 洛谷 P2894 [USACO08FEB]酒店Hotel
题目描述 The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a ...
- AS400服务程序总结
1.服务程序的创建和调用过程 1.1生成module 1.2编写BND文件确定输出接口 1.3生成服务程序 1.3.运行调用程序时,将服务程序导入到作业内存区active group,常驻内存 2.结 ...
- 字符串翻转(java)
1 递归,二分 private static String reverse(String s) { int N = s.length(); if(N <= 1) return s; String ...
- iview modal 弹框 模板
iview modal 弹框 模板 <!-- * @description 上传图片 * @fileName camera.vue * @author 彭成刚 * @date // :: * @ ...
- c++ vector容器遍历方式
#include <vector> #include <iostream> class Test { public: int a; int b; int c; Test() { ...