Discount 折扣
来源:互联网 发布:扫图软件 编辑:程序博客网 时间:2024/06/12 01:07
描述
People like to buy gifts in discount. For example, gift A with initial price RMB50, 30% off actually costs RMB35, gift B with initial price RMB104, 17% off actually costs RMB86.32.
Mr.Richman is a rich man. He hates small money, so he always pays an integer number of RMBs without getting any change. What's more, being a traditional Chinese person, the amount of money he pays always contains the lucky digit '8' (of course, the integer MUST be at least the actual price after discount). For example, he would pay RMB38 for gift A, and RMB87 for gift B.
Given the initial price and the discount for a gift, calculate how much Mr.Richman would like to pay.
输入
The first line contains t (1 <= t <= 20), the number of test cases followed. Each line contains two integers P and D(1 <= P <= 500; 1 <= D <= 99), the initial price and discount.
输出
For each test case, print the amount of money Mr.Richman would like to pay.
样例输入
50 30
104 17
500 4
498 6
40 5
样例输出
87
480
478
38
描述
输入
第一行包含一个数字t(1≤t≤20),表示紧接着有t个测试数据,后面每行2个数字P和D(1≤P≤500,1≤D≤99),即为初始标价和折扣比例(百分比)。
输出
计算每个测试数据,并输出Richman应该会付款的数目。
样例输入
50 30
104 17
500 4
498 6
40 5
样例输出
87
480
478
38
#include<iostream>using namespace std;bool IsHaveEight(int n){ int a; while(n){ a=n%10; if(a==8) return 1; n/=10; } return 0;}int main(){ double p,d,s; int n,j; cin>>n; while(n--){ cin>>p>>d; s=p*(1-d/100); if(s==int(s)) j=int(s); else j=int(s+1); for(;!IsHaveEight(j);j++) ; cout<<j<<endl; } return 0;}
- Discount 折扣
- OpenCart根据支付方式(Payment)提供折扣(Discount)功能插件
- Discount
- Discount
- discount
- Magento给产品添加“new”或者折扣数量标签 magento new label. discount label
- Chapter9——商店销售某一商品,每天公布统一的折扣(discount)。
- 折扣
- HDU4104----Discount
- HDOJ4104 Discount
- hdu4104 Discount
- Maximal Discount
- 现金折扣
- 商务英语:折扣
- 商场折扣
- 折扣BUG
- FOJ 1773 Discount
- HDU:4104 Discount
- OJ笔记:查看程序运行时间
- 设计模式 六大原则
- java小知识点
- Kernel Source片段 -- 协议处理函数的组织
- Windows Mobile 6 中为开发人员提供的新功能
- Discount 折扣
- 1510. Mispelling 喵~o( =∩ω∩= )m
- ThreadLocal浅析
- [Unity3d]水果忍者-切水果功能
- jetty学习1-SelectChannelConnector
- Smartphone 应用程序安全与代码签名模型开发人员实用指南
- 以MAD为例学习ENVI编程
- Android 自定义SeekBar控件
- Jetty6控制/通讯主要源代码分析