• FZU Problem 2244 Daxia want to buy house


    模拟题,注意:

    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 *= 10000;
        mon *= 12;
        rate /= 100;
        rate /= 12;
        double ans = all*(rate*pow(1+rate,mon*1.0))/(pow(1+rate,mon*1.0)-1);
        return ans;
    }
    void work ()
    {
        //cout<<calc(107,rate_bussiness,20)<<endl;
        int total = (int)floor(0.7*price_house);
        int pr_begin=0;
        double pr_month=0;
        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
    ",pr_begin,pr_month);
            return ;
        }
        else
        {
            pr_month += calc(total,rate_fund,year);
            pr_begin = price_house - total;
            printf ("%d %0.0f
    ",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 0;
    }
    View Code
  • 相关阅读:
    pyspider安装
    阿里云服务器数据盘扩容
    笔记之Python网络数据采集
    Nginx如何隐藏index.html
    使用fiddler手机抓包
    Git基本常用命令
    27 和为S的两个数字
    26 函数形参值回传问题——C++解决多个return的一般方法
    25 面向对象设计实例——基于PCL点云库的通用工具开发
    23 Pro/E二次开发中的问题记录
  • 原文地址:https://www.cnblogs.com/liuweimingcprogram/p/5785109.html
Copyright © 2020-2023  润新知