首页 > 其他分享 >4月25日打卡

4月25日打卡

时间:2023-04-25 17:24:29浏览次数:38  
标签:25 y8 x8 result printf y1 打卡 y3

 

#include<bits/stdc++.h>
using namespace std;
int main(){
    int x1, x2, x3, x5, x8, y1, y2, y3, y5, y8;
    
    double max = 0.0, result;
    
    for(x8 = 0;x8 <= 2; x8 ++){
        for(x5 = 0; x5 <= (20 - 8 * x8) / 5; x5 ++){
            for(x3 = 0; x3 <= (20 - 8 * x8 - 5 * x5) / 3; x3 ++){
                for(x2 = 0; x2 <= (20 - 8 * x8 - 5 * x5 - 3 * x3) / 2; x2 ++){
                    
                    x1 = 20 - 8 * x8 - 5 * x5 - 3 * x3 - 2 * x2;
                    
                    result = 2000.0 * pow((1 + 0.0063 * 12), x1) * pow((1 + 2 * 0.0066 * 12), x2) * pow((1 + 3 * 0.0069 * 12), x3) * pow((1 + 5 * 0.0075 * 12), x5) * pow((1 + 8 * 0.0084 * 12), x8);
                    
                    if(result > max){
                        max = result;
                        y1 = x1;
                        y2 = x2;
                        y3 = x3;
                        y5 = x5;
                        y8 = x8;
                    }
                }
            }
        }
    }
    printf("获得利息最多的存款方式为: \n");
    printf("8 年期限的存了%d次\n", y8);
    printf("5 年期限的存了%d次\n", y5);
    printf("3 年期限的存了%d次\n", y3);
    printf("2 年期限的存了%d次\n", y2);
    printf("1 年期限的存了%d次\n", y1);
    
    printf("存款人最终的获得的本息合计:%0.2f\n", result); 
    
}

 

标签:25,y8,x8,result,printf,y1,打卡,y3
From: https://www.cnblogs.com/kongxiangzeng/p/17353260.html

相关文章

  • 建民每日打卡4.25
    一、问题描述本题要求你计算A−B。不过麻烦的是,A和B都是字符串——即从字符串A中把字符串B所包含的字符全删掉,剩下的字符组成的就是字符串A−B。二、流程设计输入为包含空格的字符串,所以用getls()读入。每个字符串都是由可见的ASCII码和空白字符组成,所以只需要将B中出现的......
  • 【SD集训】20230425 T2 差(difference) 题解 CF1500F 【Cupboards Jumps】
    大家可以猜猜看为什么有两个标题,因为这个原因本文就不设密码了,被He_ren的原题创到了。吐槽一下,He_ren甚至出原题还用脚造数据,虽然数据确实比较难造。不过那两个\(O(n^2)\)老哥好像都没最后将所有数调整成非负,遗憾20。有人场切*3500却没过签到题,我不说是谁。题目描述......
  • 分治算法:剑指 Offer 25. 合并两个排序的链表
    题目描述:输入两个递增排序的链表,合并这两个链表并使新链表中的节点仍然是递增排序的。 限制:0<=链表长度<=1000 解题思路:    classSolution{publicListNodemergeTwoLists(ListNodel1,ListNodel2){ListNodedum=newListNode......
  • 做题整理 4.25
    字符串P3538[POI2012]OKR-AHorriblePoem给定字符串,多次询问其子串的最小循环节长度。由于循环节长度\(len\)一定是子串长度的约数,我们可以不断试除\(len\)的最小质因子,并判断是否合法,更新\(ans\)的最小值。线性筛预处理所有数(\(\le5\times10^5\))的最小质因子;判断是......
  • 打卡第十一天
    编写一个求x的n次方的函数一、1.新定义函数power,在进行调用/二、三、#include<iostream>usingnamespacestd;doublepower(doublex,intn){ doubleq=1.0; while(n--) q*=x; returnq;}intmain(){ cout<<"4的3次方是"<<power(4,3)<<endl; return0;}四、#incl......
  • 20230425001 - DataGridView绑定了数据之后, 再添加CheckBox列的解决方案
                 DataGridViewCheckBoxColumncheckBoxColumn=newDataGridViewCheckBoxColumn();           checkBoxColumn.Name="select";           checkBoxColumn.HeaderText="选择";           dgv_M.Columns.Inse......
  • 2014 Pacific Northwest Region Programming Contest—Division 2 Problem U — lim
    Incollegefootball,manydifferentsourcescreatealistoftheTop25teamsinthecountry.Sinceit’ssubjective,theselistsoftendiffer,butthey’reusuallyverysimilar.Yourjobistocomparetwooftheselists,anddeterminewheretheyaresimi......
  • 打卡6
    #include<iostream>usingnamespacestd;intmain(){intscore=0; cout<<"请您输入一个分数:"<<endl; cin>>score; if(score>700) { cout<<"恭喜您考上石家庄铁道大学"<<endl; }elseif(score>600) { ......
  • CVE-2015-5254漏洞复现
    1.漏洞介绍。ApacheActiveMQ是美国阿帕奇(Apache)软件基金会所研发的一套开源的消息中间件,它支持Java消息服务,集群,SpringFramework等。ApacheActiveMQ5.13.0之前5.x版本中存在安全漏洞,该漏洞源于程序没有限制可在代理中序列化的类。远程攻击者可借助特制的序列化的Java......
  • Codeforces Round #225 (Div. 2) C. Milking cows Greedy
    Iahubhelpshisgrandfatheratthefarm.Todayhemustmilkthecows.Therearencowssittinginarow,numberedfrom1tonfromlefttoright.Eachcowiseitherfacingtotheleftorfacingtotheright.WhenIahubmilksacow,allthecowsthatseet......