G(UVALive 7815)
来源:互联网 发布:在ipad上开淘宝店 编辑:程序博客网 时间:2024/06/06 17:24
点击此处将进入题目
G
The amount of income tax imposed on any taxpayer depends on his/her income.
For an income less than or equal to 1,000,000 Oshloobs, no tax is paid.
For an income greater than 1,000,000 and less than or equal to 5,000,000 Oshloobs,
the tax is 10% of the income. For an income over 5,000,000 Oshloobs, the tax is 20% of the income.
You should write a program to calculate the net income of any given employee after the deducted tax.
Input
There are multiple lines in the input. Each line contains
an employee’s income before the tax, which is a positive integer,
a multiple of 1000, and not greater than 10,000,000.
The input terminates with a line containing ‘0’ which should not be processed.
Output
For each employee, output a line containing the net income after the deducted tax.
Sample Input
10000
50000
2000000
7500000
0
Sample Output
10000
50000
1800000
6000000
这道题很简单,就是如果超过1000000就打九折,超过5000000就打八折。
但是要注意的是精确度,如果用int型,那得到的结果可能会有误差,所以我是用double型做的
代码:
#include<stdio.h>#include<algorithm>using namespace std;int main(){ double n; while(~scanf("%lf",&n)) { double m=0; if(n==0) break; if(n>5000000) m=n-n*0.2; else if(n>1000000) m=n-n*0.1; else m=n; printf("%.0lf\n",m); } return 0;}
阅读全文
0 0
- G(UVALive 7815)
- UVALive 4670(KMP)
- UVALive 3026(KMP)
- UVALIVE 3516(DP)
- ( UVALive 7720)J
- (UVALive 7711)A
- I(UVALive 7816)
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- 数据结构-普通二叉树
- JAVA架构师必备词汇和知识点
- 蓝桥杯:基础训练——芯片测试
- 一篇关于Java入门类的易懂技术文章
- <c:import>标签的文件混合和代码混合使用
- G(UVALive 7815)
- Java学习-Tcp_Socket实现多线程通信
- echarts异步加载柱状图数据叠加
- .NET 语音转文字 文字转语音
- C语言的枚举类型(enumeration)
- 任意进制转化
- 377. Combination Sum IV
- Combinatorics——HDUOJ 2110
- python与正则表达式