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

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
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大数据搜索

你可能感兴趣的:(C语言Matrix)