P1687 大学生的生活费

最佳存款方案 假设银行一年整存零取的月息为0.63%。现在某人手中有一笔钱,他打算今后的5年终的每年年底取出1000元,到第5年时刚好取完,请算出他存钱时应存入多少。第5年年初的初款歀数=1000/(1+12*0.0063) 第4年年初的初款歀数=(第5年年初的初款歀数+1000)/(1+12*0.0063) 第3年年初的初款歀数=(第5年年初的初款歀数+1000)/(1+12*0.0063) 第2年年初的 阅读详情

题目描述

父母为儿子大学四年生活费存了一笔钱,方式是整存零取, 规定儿子每月月底取走下月的生活费 M 元。现在假设银行的年利率是 1.71%,现在计算母亲至少存多少钱?(保留 2 位小数)

输入描述

多组输入,每组一个整数 M,代表每月的生活费。

输出描述

父母亲一次性要存入的生活费(保留 2 位小数)

样例输入

Copy to Clipboard
3000 2000 

样例输出

Copy to Clipboard
139089.86 92726.58

 

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m;
    while(cin>>m)
    {
        double k=m;
        for(int i=1;i<=48;i++)
            k=(k)/(1+0.0171/12)+m;
        printf("%.2f\n", k-m);

    }
}

 

python学习 - 存钱问题 【问题描述】 父亲准备为小龙的四年大学生活一次性储蓄一笔钱,使用整存零取的方式,控制小龙每月月初取1000元准备这个月使用。假设银行整存零取的年息为1.71%,请算出父亲至少需要存入多少钱才行。 【问题分析】 这个问题是一个典型的递推问题,分析存钱和取钱的过程,我们可以采用逆推的方法。4年48个月,每月取1000元,最后一个月正好取完。我们可以采用一个数组存放每个月剩余的钱数,那么最后一个月连本带息为1000,即第48个月数组里的值为1000。 第47个月的存折里钱为:取走的1000元生活费+下个月1000 阅读详情

相关推荐

学生消费管理系统(C/C++)《C语言程序实践》

代码可以实现的功能: (1)直接从终端键盘输入信息 (2)从磁盘文件录入学生信息 (3)可以查询学生消费信息 (4)可以删除学生信息 (5)可以添加学生的消费信息,并显示添加后学生的人数 (6)显示录入的学生信息 (7) 把录入的学生信息保存到指定的文件中 (喜欢的小伙伴记得分享给身边的小伙伴哦!点点赞,谢谢啦!) #include <stdio.h> #include <stdlib.h> #include <string.h> #define LEN sizeof(s

aiyiyi1314的博客 6325

逆推:该存多少钱

父亲准备为小龙的4年大学生活一次性在银行储蓄一笔钱,使用整存零取的方式,控制小龙每月底只能提取1000元准备下月使用,假设银行年利息为1.71%,请编写程序计算出父亲至少需要一次性存入多少钱才能够小龙4年大学生活(4年的利息也应计算在内)。 解题思路: 分析存钱和取钱的过程,可以采用地递推的方法。 第48个月取出1000,则要先求出47个月时银行存款的具体金额: 第47个月的存款=1000/(1+1.71%/12) 第47个月的存款=(第47个月的存款+1000)/(1+1.71%/12) … 第1个.

小白兔奶糖の博客 341

OMNET++ INET框架学习教程(一)

在自组网学习的道路上摸石头过河,帮你快速入门OIMNET++平台下的INET框架。

NLDwangzhe的博客 6569

九种基本算法思想

枚举算法 基本思想 枚举法也叫穷举算法,是指将问题的所有可能的结果一一列举,然后根据条件判断是否适合,适合就保留,不是喝酒舍弃; 一般采用while 循环实现。 实例演练 百钱买百鸡问题:公鸡每只5 元, 母鸡每只 3 元, 小鸡 3 元一只。 先用100元钱,买公鸡、母鸡、小鸡各几只? 代码: #include <stdio.h> int main() { int x,y,z; for(x=0;x<=20;x++) { ...

woaini886353的博客 428

Flexible H-Tree(灵活 H 树)与 Multi-Tap 时钟流程解析

通过灵活 H 树与多抽头技术的结合,复杂时钟架构可在保持电气对称性的同时适应不规则布局,为高性能、低功耗 SoC 设计提供高效的时钟网络解决方案。

weixin_45371279的博客 1941

fluent二维叶型仿真_Fluent案例4【自然对流】

自然对流来了!!江苏的高校好多开学了,我啥时候才能开学另外,刚才看了何同学的Mac Pro深度体验视频,我好酸/(ㄒoㄒ)/~~好想拥有一台跑仿真那种sou~sou~sou~的机器。废话不多说了,进入正题!案例题目:一个矩形空腔内有500K恒温小球,矩形空腔充斥空气,边界条件绝热,模型尺寸如下,试模拟空腔内空气流动状态做出温度变化图。(尺寸大小懒得写了,在建模部分里有)操作平台:workbench...

weixin_39724469的博客 3676

银行存款问题(java)

银行存款问题(逆推) 母亲为儿子Frank的四年大学学费准备了一笔存款,方式是整存零取,规定Frank每月月底取下一个月的生活费。 现在假设利率为1.71%,编写程序,计算母亲最少需要存多少钱? 可以采用逆推法分析存钱和取钱的过程,因为按照月为周期取钱,所以共四年48个月,并分别对每个月进行计 算。如果在第48个月后sun大学毕业时连本带利要取1000元,这要求出前47个月时银行存款的钱数。 (1...

魍魉 2573

Java 简易版 UDP 多人聊天室

【代码】Java 简易版 UDP 多人聊天室。

nmy15570188135的博客 1191

C语言课程设计-学生个人生活费管理系统

先通过学生生活费录入录入信息,在用下面(3)学生生活费统计函数(4)学生生活费排序函数(5)学生生活费筛选函数等三个函数进行运行,得出结果。2.系统功能需求分析:一直以来,一些学生自己的经济管理能力较差,为了方便学生进行管理生活费,选择设计编辑此程序。(1)strcut student结构体变量。1.设计题目:学生个人生活费管理系统。(2)int main()主函数。主要阐述功能模块的算法设计思路。

m0_54570435的博客 1446

Codex+GPT自动生成学术PPT:配置Skill与全流程实操指南

在科研工作中,重复性的材料整理与汇报制作常消耗大量时间。借助AI代理与语言模型的协同,可以将这一流程自动化。Codex本质上是一个连接模型与本地环境的执行代理,它负责读写文件、运行命令,而GPT负责理解意图并生成内容,二者结合能够将“研究方向”直接转化为结构完整的学术PPT。要实现这一能力,关键在于正确配置模型、合理设计Skill机制(即固化工作流的规则文件),并掌握常见报错如“gpt-5.6-sol model is not supported”的排查方法。从材料准备、大纲生成到PPT绘制,再到人工校准,

weixin_29052717的博客 618

4、硬件工程师笔试面试知识器件篇——电阻(2025版本)

本文系统介绍了电阻的基础知识与应用。首先阐述了电阻的定义、工作原理及类型(固定/可变电阻),详细说明了常见电阻材料(碳膜、金属膜、线绕等)的特性与标记方法。重点分析了电阻在电路设计中的关键参数:功率计算需考虑1.5-2倍安全裕度,温度系数影响电路稳定性。文章还对比了不同封装形式(轴向/贴片/功率封装等)的适用场景,特别强调高功率电路需选择专用封装并做好散热设计。最后指出电路仿真可优化电阻选择,并列举了相关电子元件在设计中同样需要仿真验证。全文为硬件工程师提供了电阻选型的实用指导。

XU157303764的博客 5223

银行存款(C语言,递推法)

题目: 母亲为儿子sun 4年的大学生活准备了一笔存款,方式是整取零存,规定sun 每个月月底取下一个月的生活费。假设银行年利息为1.71%,计算该母亲每个月至少要存入多少钱? 算法分析: 可采用逆推法分析存钱和取钱的过程,因为按照月为周期取钱,所以4年可以分为48个月,并对每个月进行计算。 递推法 顺推法:从已知条件出发,逐步推算出要解决问题的方法(例如斐波拉契数列) 逆推法:从已知的结果出发...

Zhangguohao666的博客 4739

机器视觉应用工程师职位深度解析与面试指南

广东奥普特科技招聘机器视觉应用工程师,要求大专以上理工科专业背景,熟悉C/C++或PLC编程,具备自动化设备调试经验。岗位职责包括视觉项目方案评估、系统安装调试、售后技术支持及异常处理,需接受外派出差。该职位面向专业对口的应届生或实习生,强调动手能力、沟通技巧和吃苦耐劳精神。机器视觉工程师需掌握图像处理算法、硬件配置等核心技术,在工业自动化领域具有良好发展前景。求职者应注重编程能力和实践经验的积累,以胜任这一技术密集型岗位。

郑伟强dev的专栏 447

存钱问题

问题描述:父亲准备为小龙的四年大学生活一次性储蓄一笔钱,使用整存零取的方式,控制小龙每月月初取1000元准备这个月使用。假设银行整存零取的年利息1.71%,请算出父亲至少需要存入多少钱才行。思路:现在已知的条件是大学四年共48个月,每月要取出1000元,银行整存零取的年利息是0.0171,那么解题思路就有两种:一是假设存入的总钱数,使其满足每月能取出1000元钱的关系,二是根...

weixin_34309435的博客 2665

Android 13.0 开机启动优化之PMS扫描apk耗时相关功能优化

在android13.0的系统rom定制化开发中,在系统中开发产品时,会根据客户要求内置第三方app,这时如果内置app过多,或者安装的app过多,在系统开机的过程中 在pms扫描安装app的时候,就会比较耗时,这时候就需要优化下pms扫描安装app这块的功能代码,用多线程来实现pms扫描安装app,来加快开机时间,接下来 来实现这个功能

安卓兼职framework和app工程师的博客 1340

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

题:生活费用

/*编程记录有一年的生活费用,统计一年总费用是多少?找出最多费用的月份和费用数目,最少费用的月份和费用数目, 每个月的费用从键盘输入*/ #include<stdio.h> int main() { int i = 0; int arr[13] = { 0 }; int count = 0;//计算总额 int min = 0; int max = 0; for (i = 1; i <= 12; i++)//i表示一年的月份。 .

Dingyuan0的博客 1196

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

C/C++:个人收支系统实现

昨天朋友委托我做一个基于C++的课程小设计,题目如下: 设计一个简单的个人收支管理系统,至少包括如下功能: 1、逐笔输入个人收入或支出的明细,写入到文件保存,可不断进行输入和追加。 输入的明细数据包括:收支明细类别编码、发生日期、金额、备注。 1)为了简化用户的输入,类别编码由字母和数字构成:“a”表示收入、“b”表示支 出,数字是大类下的编号。类别编码及类别名称的对应由自己定义、组织在程序中 并输出展示。比如 a1 表示收入类的生活费,b1 表示支出类的学习,编号依次递增, 类别的数量和名称根据日常需要自

Jimobbb的博客 8063

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

递推算法—逆推案例(大学生存款)(C语言)

1、若再第48月小晨大学毕业时连本带息要取1000元,则要先求出第47个月时银行存款的钱数。 2、第47月月末存款=1000/(1+0.0171/12)。 3、第46月月末存款=(第47月月末存款+1000)/(1+0.0171/12)。 4、依此类推,可以求出第45月、第44月…的月末存款的数值。 C语言相关代码: #include <stdio.h> #define FETCH ...

carakia的博客 1917

湘潭大学c语言绩点_大学生活篇│考试周的大学生有多难,你可能想象不到

期末考试要来了,相信各位小伙伴的小心脏也是在上蹿下跳。各位“学渣”“学霸”也是忙得不可开交。“学渣”忙着各处收罗考试重点,“学霸”则开起了寝室小课堂,当起了“学渣”的梦想导师。眼下的考试周,你是不是也到了一看到书就头晕眼花想吐?现在的大学挂科有多危险,你也应该感受到了吧,分分钟让你毕不了业。为了不挂科,为了能够顺利毕业,最近职鹤君听到不少童鞋的苦水:同学A:一周学四五本课本,洗头的时候头发大把大把...

weixin_35726575的博客 741

假设银行一年整存零取的月息为0.63%。现在某人手中有一笔钱, 他打算在今后的5年中的每年年底取出1000元, 到底5年时刚好取完,请算出他存钱时应存入多少?

#include /* 假设银行一年整存零取的月息为0.63%。现在某人手中有一笔钱, 他打算在今后的5年中的每年年底取出1000元, 到底5年时刚好取完,请算出他存钱时应存入多少? */ int main() {     int i;     double money = 0.0;     for(i = 0; i     {         money

YEDITABA的博客 1万+

算法洗脑系列(8篇)——第一篇 递推思想

     像俺一样奋斗在一线的码农们,一谈到学编程,都是说要学会XX语言就OK了,其实我们理解的有一点点的偏差,因为我们只说到了 三分之一,其实真正的编程应该是:编程=数据结构+算法+XX语言。     对的,XX语言只是一个工具而已,就好比我们知道用笔来写字,但是不见得我们就能写出一手让张恨水为之倾倒的好字,其实我也说过 算法不仅仅用于程序设计中,在我们的生活中也处处存在着算法,比如记得我...

weixin_33709219的博客 228

9种基本算法_递推

递推思想:利用某个已知的条件

A306599934的专栏 1001
上一篇: P1686 封闭曲线分平面问题
下一篇: P1131 子串
代维7
博客等级 码龄6年 1万+粉丝 535原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值