C语言Matrix编程题——[Arrays]D. Liang 6.13 Finding the sales amount

[Arrays]D. Liang 6.13 Finding the sales amount

Description:

You have started a sales job in a department store.
Your pay consists of a basis salary and a commission. The base salary is $5000.
The scheme shown below is used to determine the commission rate.

Sales Amount        Commission Rate
---------------------------------------
$0.01-$5000             8 percent
$5000-$10000           10 percent
$10000.01 and above    12 percent

Your goal is to earn $n a year. Write a program that finds out the minimum amount
of sales you have to generate in order to make $n.

Input:

The first line is a positive integer t for the number of test cases.
Each test case contains an double value n (0<n<=1000000).

Output:

For each test case, outputs the minimum amount of sales you have to generate in order to make $n.
You should specified the floating-point number’s precision to 0 and fixed.

Sample Input:

2
30000
60000

Sample Output:

210833
460833

Programme:

//Date:2020/4/24
//Author:Kamenrider Justice
#include<stdio.h>
int main()
{   
   int count,i;//count是输入的次数
   double n,min;//n是预期要赚到的钱,min是最低的销售量  
   scanf("%d",&count);
   for(i=0;i<count;i++) //简单的阶梯应用题
   {       
      scanf("%lf",&n);       
      if(n<=5400)       
      {           
         min=(n-5000)/0.08;       
      }       
      else if(n>5400&&n<=5900)       
      {           
         min=((n-5400)/0.1)+5000;       
      }       
      else if(n>5900)       
      {        
         min=((n-5900)/0.12)+10000;     
      }       
      printf("%.0f\n",min);   
   }   
   return 0;
}

Python大数据搜索

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值