模拟题,注意:

1、那两个贷款都是向银行贷的,就是两个贷款的总额不能超过70%,就算公积金贷款能贷也不行,我开始的时候以为公积金贷款是向公司借的,,欺负我这些小白嘛....

2、最坑的地方 *0.7是wa的,要*7/10

3、那个公式的-1不是减在月份上的,是减在总体上的

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
int price_house,max_fund;
double rate_bussiness,rate_fund;
int year;
double calc (int all,double rate,int mon)
{
all *= ;
mon *= ;
rate /= ;
rate /= ;
double ans = all*(rate*pow(+rate,mon*1.0))/(pow(+rate,mon*1.0)-);
return ans;
}
void work ()
{
//cout<<calc(107,rate_bussiness,20)<<endl;
int total = (int)floor(0.7*price_house);
int pr_begin=;
double pr_month=;
if (total >= max_fund)
{
total -= max_fund;
pr_month += calc(max_fund,rate_fund,year);
pr_month += calc(total,rate_bussiness,year);
pr_begin = price_house - total - max_fund;
printf ("%d %0.0f\n",pr_begin,pr_month);
return ;
}
else
{
pr_month += calc(total,rate_fund,year);
pr_begin = price_house - total;
printf ("%d %0.0f\n",pr_begin,pr_month);
}
return ;
}
int main()
{
#ifdef local
freopen("data.txt","r",stdin);
#endif
while(scanf("%d%d%lf%lf%d",&price_house,&max_fund,&rate_bussiness,&rate_fund,&year)!=EOF)
work();
return ;
}
05-11 15:37