• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

ph-123456

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

8 求月利率

include

include<string.h>

include<stdio.h>

include

include <ctype.h>

using namespace std;

int main() {
int a, b, c;

cin >> a >> b >> c;
double low = 0.0, high = 300.0, mid;
while (high - low > 0.001) {
	mid = (low + high) / 2;
	double t = a;
	for (int i = 0; i < c; i++) {
		t += t * mid / 100;
		t -= b;
	}
	
	if (t >0) { high = mid; }
	
	else { low = mid; }
}

cout << a << b << c <<low<<high<< endl;
printf("%.1f", (low + high) / 2);
return 0;

}

posted on 2024-11-13 12:36  哈哈哈哈666  阅读(8)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3