c语言及程序怎么进行设计

公司的奖金根据业绩分配。奖金分配方案按工作业绩的分配奖金,具体如下:
①业绩金额<1万元,奖金按3%提成。
②1万元s业绩金额<5万元,奖金按10%提成。
③5万元s业绩金额<20万元,奖金按15%提成。
④业绩金额超过20万元,超过部分按20%提成。

是阶梯式吗?

#include <iostream>
using namespace std;
int main()
{
     double yj = 0;
     cin>>yj;
     double jj = 0;
     if(yj < 10000)
          jj = yj * 0.03;
     else if(yj < 50000)
         jj = 10000 * 0.03 + (yj-10000)*0.1;
     else if(yj < 200000)
        jj = 10000 * 0.03 + 40000 * 0.1 + (yj - 50000) * 0.15;
     else
        jj = 10000 * 0.03 + 40000 * 0.1 + 150000 * 0.15 + (yj - 200000) * 0.2;
     cout<<jj;
}

  • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/162727
  • 这篇博客也不错, 你可以看下深耕金融行业数字化转型,人大金仓数据库自主可控解决方案综述
  • 除此之外, 这篇博客: 黄金搜索算法中的 2. 黄金搜索用于路径点搜索 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 这部分代码只能说,赐予有缘人了哈哈
    算法思路来源于apollo代码,我自己重新总结了一下。只看这段代码应该只能说,知道黄金搜索算法在二维路径点的搜索上可以使用。具体的不介绍

    typedef struct PathPoint
    {
        double x; // 在地图上slam返回的x
        double y; // 在地图上slam返回的y
        double theta; // 在地图上slam返回的theta
        double s; // 在frenet轨迹上的s
        double d; // 在frenet轨迹上的d
        double kappa; // 在frenet轨迹上的弧度kappa
        
    }PathPoint;
    // 距离插值
    double lerp(double x0, double t0, double x1, double t1, double t) 
    {
        if (abs(t1 - t0) <= 1.0e-6) 
        {
        return x0;
        }
        double r = (t - t0) / (t1 - t0);
        double x = x0 + r * (x1 - x0);
        return x;
    }
    
    double dist_square(PathPoint &p0, PathPoint &p1, double s, double x, double y)
    {
        double px = lerp(p0.x, p0.s, p1.x, p1.s, s);
        double py = lerp(p0.y, p0.s, p1.y, p1.s, s);
        double dx = px - x;
        double dy = py - y;
        return dx * dx + dy * dy;
    }
    // 黄金搜索
    double goldenSectionSearch(PathPoint &p0, PathPoint &p1, double x, double y) 
    {
        double tol = 0.1;
    
        double gr = (sqrt(5) + 1) / 2; // 1.618033989
    
        double lower_bound = p0.s;
        double upper_bound = p1.s;
        double a = lower_bound;
        double b = upper_bound;
    
        double t = (b - a) / gr;
        double c = b - t;
        double d = a + t;
    
        while (abs(c - d) > tol) 
        {
            if (dist_square(p0, p1, c, x, y) < dist_square(p0, p1, d, x, y)) 
            {
                b = d;
            } 
            else 
            {
                a = c;
            }
            t = (b - a) / gr;
            c = b - t;
            d = a + t;
        }
        return (a + b) * 0.5;
    }