【模拟】FOJ 2244 Daxia want to buy house
2024-10-19 17:46:26
题目链接:
http://acm.fzu.edu.cn/problem.php?pid=2244
题目大意:
每月还款额=贷款本金×[月利率×(1+月利率)^还款月数]÷[(1+月利率)^还款月数-1]
由于商业贷款利率高于公积金贷款利率,优先公积金贷款,超出部分再采用商业贷款.
银行至多给予贷款总额最多不超过70%,且数额必须为万的整数倍,daxia想尽量少首付多贷款.
题目思路:
【模拟】
直接模拟就行,连快速幂都可以不用。
注意不能*0.7要*7/10!!!!!!
//
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 224
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
double mi(double x,int y)
{
double sum=;
while(y)
{
if(y&)sum=sum*x;
x=x*x;
y>>=;
}
return sum;
}
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k,y,dk,dk1,dk2;
double r1,r2,y1,y2;
// for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
while(~scanf("%d",&n))
// while(~scanf("%d",&n))
{
scanf("%d",&m);
scanf("%lf%lf",&r1,&r2);
scanf("%d",&y);y=y*;
dk=n*/;r1/=;r2/=;
dk2=min(dk,m);dk1=dk-dk2;
n-=dk;
y1=mi(+r1,y);
y1=*dk1*r1*y1/(y1-);
//if(int(y1*10)%10>=5)y1+=1;
y2=mi(+r2,y);
y2=*dk2*r2*y2/(y2-);
//if(int(y2*10)%10>=5)y2+=1;
printf("%d %d\n",n,int(y1+y2+0.5000001));
}
return ;
}
/*
// //
*/
最新文章
- ASP.NET Core 中文文档 第四章 MVC(4.1)Controllers, Actions 和 Action Results
- nginx 安全优化
- iOS 学习 - 22 异步解析 JSON,使用 FMDB 存储,TableView 显示
- SQL --Chapter 04 数据更新
- OEM代工厂产品经理个人经历谈
- hiho一下 第一百零七周 Give My Text Back(微软笔试题)
- oracle定时器,调用存储过程,定时从n张表中取值新增到本地一张表中
- Tomcat数据库连接池的配置方法总结
- python之supervisord启动脚本
- VS2012新建项目出错:未找到与约束
- Linux的nginx环境的vue 部署
- 升级gitlab
- 关于jquery日期控件及时间格式转换2017.05.27
- 两个inline-block中间有空白,解决inline-block 元素之间的空白问题
- Java使用RSA加密解密签名及校验
- springmvc功能以及源码实现分析
- Django urls 路由
- 使用博客系统发生_STORAGE_WRITE_ERROR_错误
- 完全使用css编写复选框
- net 把指定 URI 的资源下载到本地