求知 求是 2017-11-07 03:23 采纳率: 0%
浏览 4552

如何用C写博弈论之Best Response?

题目内容:
在博弈论中,有一种决策称为Best Response,通俗的意思就是选择一种策略使得团体利益最大化。C语言学习成绩的评定方式分为两种,一种是自由刷题模式(compete),没有固定标准,刷题越多者排名越靠前,其期末分数越高;另一种是规定每个人必须做够多少道题(standard),达到要求就能取得相应分数。

假设一个班级中的学生分为A、B两类,A类同学学习热情很高,乐于做题,采用compete模式可以获得成就感并且在期末拿到高分,compete模式可以让他们有10分的收益;采用standard模式他们也可以在期末拿到高分,但不能满足他们的求知欲,standard模式可以让他们有8分的收益。B类同学仅仅希望期末拿高分,如果采用compete模式,他们竞争不过A类同学,期末成绩不理想,因此compete模式能给他们6分的收益;如果采用standard模式,他们可以完成规定任务并拿到高分,因此standard模式可以让他们有10分的收益。

编程输入A类和B类同学分别占班级总人数的百分比,分别计算并输出采用compete和standard两种刷题模式下的全班总收益,并输出这个班级在这场博弈中的Best Response是哪种模式。
注: 程序中使用的数据类型为float
程序运行结果示例1:
Input percent of A and B:0.2 0.8↙
compete = 6.8000
standard = 9.6000
The Best Response is standard!

输入提示信息:"Input percent of A and B:"
输入格式: "%f%f"
输出格式:"compete = %.4f\nstandard = %.4f\n"
输出提示信息:"The Best Response is compete!"
输出提示信息:"The Best Response is standard!"

  • 写回答

2条回答 默认 最新

  • 国科大小渣渣 2019-01-01 12:08
    关注

    #include
    #include

    int main()
    {
    float PerscentA,PerscentB,Profit1,Profit2;
    printf("Input percent of A and B:");
    scanf("%f,%f",&PerscentA,&PerscentB);
    Profit1 = PerscentA*10 + PerscentB*6;
    Profit2 = PerscentA*8+PerscentB*10;
    printf("compete = %.4f\nstandard = %.4f\n",Profit1,Profit2);
    if(Profit1 > Profit2)
    printf("The Best Response is compete!");
    else
    printf("The Best Response is standard!");

    return 0;
    

    }

    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示