生活中的数学问题(四)
来源:互联网 发布:知豆汽车有限公司待遇 编辑:程序博客网 时间:2024/05/09 22:48
/**************************************** * File Name : math.c * Creat Data : 2015.1.24* Author : ZY *****************************************/ /*生活中的数学问题*//*假设银行整存整取存款不同期限的月息利率分别为:0.63% 期限 = 1年0.66% 期限 = 2年0.69% 期限 = 3年0.75% 期限 = 5年0.84% 期限 = 8年利息 = 本金*月息利率*12*存钱年限。现在某人手中有2000元,请通过计算选择一种存钱方案,使得钱存进银行20年后得到的利息最多(假定银行对超过存款期限的那部分时间不付利息)*/#include <stdio.h>#include <math.h>int main(){int i8,i5,i3,i2,i1,n8,n5,n3,n2,n1;float temp,max = 0.0;for( i8 = 0 ;i8 < 3;i8++ ){for( i5 = 0 ;i5 <= (20 - i8*8)/5;i5++ ){for( i3 = 0;i3 <= (20 - i8*8 - i5*5)/3 ;i3++ ){for( i2 = 0;i2 <= (20 - i8*8 - i5*5 - i3*3)/2;i2++ ){i1 = 20 - i8*8 - i5*5 - i3*3 -i2*2;temp = 2000.0*pow((double)(1+0.0063*12),(double)i1)*pow((double)(1+2*0.0066*12),(double)i2)*pow((double)(1+3*0.0069*12),(double)i3)*pow((double)(1+5*0.0075*12),(double)i5)*pow((double)(1+8*0.0084*12),(double)i8);if( temp > max ){max = temp;n1 = i1;n2 = i2;n3 = i3;n5 = i5;n8 = i8;}}}}}printf(" For maxinum profit,he should so save his money in a bank:\n");printf(" made fixed deposit for 1 year:%d times\n",n1);printf(" made fixed deposit for 2 year:%d times\n",n2);printf(" made fixed deposit for 3 year:%d times\n",n3);printf(" made fixed deposit for 5 year:%d times\n",n5);printf(" made fixed deposit for 8 year:%d times\n",n8);printf(" Total:%.1f\n",max);return 0;}
0 0
- 生活中的数学问题(四)
- 生活中的数学问题
- 生活中的数学问题(二)
- 生活中的数学问题(三)
- 生活中的数学问题(五)
- 生活中的数学问题(六)
- 生活中的数学问题(七)
- 生活中的数学问题(一)
- 生活中的数学问题(二)
- 生活中的数学问题(打鱼还是晒网)
- 生活中的数学问题(数学家的难题)
- 生活中的数学(为生活建模)
- 生活中的数学(为生活建模)(二)
- 生活中的物理、化学(四)
- 机器学习中的必修数学(四)
- 生活中的数学(为生活建模)(三)—— 代数
- ①数学之美:生活中的技术
- 生活中的数学 —— 操场几何学
- 使用Spring Annotation注解导致jar包更新的文件扫描不到
- 将在Bundle中的plist存到沙盒Document中读取
- [LeetCode]34.Search for a Range
- mac下配置环境变量
- To the Max
- 生活中的数学问题(四)
- PHP中函数变量传递
- 找数字
- ZOJ 3602 Count the Trees
- 生活中的数学问题(五)
- uva548 - Tree 入门经典II 第六章数据结构基础 例题6-8
- 操作格子(线段树)
- 生活中的数学问题(六)
- DWR笔记