fzu 2244 Daxia want to buy house
来源:互联网 发布:plc和单片机有什么区别 编辑:程序博客网 时间:2024/06/09 19:31
http://acm.fzu.edu.cn/problem.php?pid=2244
很简单的水题,但是就是过不去,问题出在在C中,对于int型 *0.7和 *7/10是会出现精度上的问题。
#include<iostream>#include<cstdio>#include<cmath>using namespace std;const int inf=0x3f3f3f3f;int ma[1111][1111];int main(){ int all,gj;double nr,gr;int year;while(scanf("%d%d%lf%lf%d",&all,&gj,&nr,&gr,&year)!=EOF){ double yl1=nr/1200; double yl2=gr/1200; int dk=all*7/10; int sf=all-dk; int sd; if(dk<=gj) sd=0,gj=dk; else sd=dk-gj; //每月还款额=贷款本金×[月利率×(1+月利率)^还款月数]÷[(1+月利率)^还款月数-1] double ans; ans=sd*1.0*(yl1*pow((1+yl1),year*12))/(pow((1+yl1),year*12)-1); double ans1=gj*1.0*(yl2*pow((1+yl2),year*12))/(pow((1+yl2),year*12)-1); long long int ans11=(ans+ans1)*10000+0.5; cout<<sf<<" "<<ans11<<endl;}return 0;}
阅读全文
0 0
- fzu 2244 Daxia want to buy house
- 【模拟】FOJ 2244 Daxia want to buy house
- FZU 2243 Daxia like uber
- fzu 2243 Daxia like uber
- FZU 2238Daxia & Wzc's problem
- FZU 2242 Daxia like acute triangle
- fzu 2238 Daxia & Wzc's problem
- fzu 2238 Daxia & Wzc's problem
- FZU Problem 2243 Daxia like uber(最短路)
- FZU/FOJ 2243 Daxia like uber【最短路SPFA+思维】
- FZU-2239 Daxia & Yayamao's problem(斜率优化)
- FZU 2239 Daxia & Yayamao's problem 斜率优化
- FZU 2238 Daxia & Wzc's problem【规律+lucas】
- I Want to Know
- I want to cry
- I Want to Know
- FZU Problem 2238 Daxia & Wzc's problem(Lucas定理求组合数)
- FZU Problem 2240 Daxia & Suneast's problem(博弈+[单点更新,区间查询]线段树)
- 201409-2 画图
- “Hello World ”
- C#.NET dll封装(包含UI和实现函数),通过反射调用dll实现控件的快速加载(PrimPointList.cs)
- java 23种设计模式 深入理解
- HDU 2062:Subset sequence
- fzu 2244 Daxia want to buy house
- linux(十)时间同步
- C语言------文件操作+字符串里的运算
- No rule to make target `include/config/auto.conf', needed by `include/ config/kernel.release'. stop
- LeetCode 之 Median of Two Sorted Arrays
- MP3播放
- C++——面向对象(二)——默认的构造函数(2)
- 通过伪类选择器调整链接属性
- Java多线程”JUC”集合中的CopyOnWriteArraySet