【模拟】FOJ 2244 Daxia want to buy house
题目链接:
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 ;
}
/*
// //
*/
【模拟】FOJ 2244 Daxia want to buy house的更多相关文章
- FZU Problem 2244 Daxia want to buy house
模拟题,注意: 1.那两个贷款都是向银行贷的,就是两个贷款的总额不能超过70%,就算公积金贷款能贷也不行,我开始的时候以为公积金贷款是向公司借的,,欺负我这些小白嘛.... 2.最坑的地方 *0.7是 ...
- 【最短路】FOJ 2243 Daxia like uber
题目链接: http://acm.fzu.edu.cn/problem.php?pid=2243 题目大意: 给一张N个点M条边的有向图,从s出发,把在x1的人送到y1,在x2的人送到y2用的最短距离 ...
- 【数论】FOJ 2238 Daxia & Wzc's problem
题目链接: http://acm.fzu.edu.cn/problem.php?pid=2238 题目大意: 已知等差数列A(0)的首项a和公差d,求出数列A(0)前n项和,得到新数列A(1);以此类 ...
- leetcode刷题总结一
大四狗找工作,要刷题了,leetcode上面题目比较适合面试算法类题目,也不纯粹为了蒙题,锻炼一下面试类型的思维 Single Number: 有N个数,其中只有一个数出现了一次,其他都是两次,找出那 ...
- FOJ有奖月赛-2016年8月(daxia专场之过四题方有奖)
http://acm.fzu.edu.cn/contest/list.php?cid=152 主要是a题, lucas定理, 就这一版能过.. 记录一下代码, 另外两个最短路 一个模拟,没什么记录 ...
- poj 2828 buy Tickets 用线段树模拟带插入的队列
Buy Tickets Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2 ...
- Leetcode 121. Best Time to Buy and Sell Stock 最佳股票售卖时(动态规划,数组,模拟)
题目描述 已知一个数组,第i个元素表示第i天股票的价格,你只能进行一次交易(买卖各一次),设计算法找出最大收益 测试样例 Input: [7, 1, 5, 3, 6, 4] Output: 5 最大收 ...
- Codeforces 740A. Alyona and copybooks 模拟
A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...
- POJ 2828 Buy Tickets(线段树 树状数组/单点更新)
题目链接: 传送门 Buy Tickets Time Limit: 4000MS Memory Limit: 65536K Description Railway tickets were d ...
随机推荐
- c# 双问号运算
model.id??0 ??运算:如果运算符左边的值为NULL侧返回右边的值,否则返回左边的值
- oracle数据库读取操作系统的物理文件-转载,待完善
--源地址不详 --创建目录SQL> create directory dir_xls as '/home/oracle'; Directory created. --给用户授权SQL> ...
- 【转】ASP.NET MVC 入门教程列表
ASP.NET MVC小论 2008-12-04 11:11 by T2噬菌体, 8052 visits, 网摘, 收藏, 编辑 摘要:ASP.NET MVC作为微软官方的.NET平台下MVC解决方案 ...
- TestNG扩展
1. TestNG API 本章节将讨论如何使用TestNG API来创建自己的TestNG对象.TestNG的API基本由接口组成,这样做是为了容易模拟TestNG返回的对象. 1.1 org.te ...
- 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型,原因为没有注册类
错误描述 e = {"无法将类型为"System.__ComObject"的 COM 对象强制转换为接口类型"OpcRcw.Da.IOPCServer" ...
- dede导航设置成单页面内容
有时顶级导航可能就是一个单页面 如公司简介 联系我们等 方法一:直接在导航栏填写内容 常规设置 二高级选项设置模板 三 填写页面内容 四 模板页面调用 内容 可在栏目模板中用{dede:field.c ...
- mysql数据类型——时间类型
四种日期格式: 每个时间类型有一个有效值范围和一个"零"值,当指定不合法的MySQL不能表示的值时使用"零"值. YEAR 0000 YYYY ...
- php计算时间差/两个时间日期相隔的天数,时,分,秒.
function timediff( $begin_time, $end_time ) { if ( $begin_time < $end_time ) { $starttime = $begi ...
- Asp.Net使用异步性能就提升吗
Asp.Net异步编程 随着.Net4.5的推出,一种新的编程方式简化了异步编程,在网上时不时的也看到各种打着Asp.Net异步编程的口号,如何提高性能,如何提高吞吐率! 好多文章都说得不清楚,甚 ...
- #module-django.db.models
Models A model is the single, definitive source of information about your data. It contains the esse ...