HDU-1994-利息计算

题目链接

http://acm.hdu.edu.cn/showproblem.php?pid=1994

水题

题目分析 就是两种储存方式,输出所得本金加利息

代码

#include<stdio.h>

int main(void)
{
double s1,s2,y,q,e,f,g;
int n;
while(scanf("%d",&n)==1)
{
while(n--)
{
scanf("%lf%lf%lf%lf%lf",&y,&q,&e,&f,&g);
if(q<100)
{
s1=y*(1+e/100*q/365);
s1=s1*(1+f/100);
}
else if(q<365)
{
s1=y*(1+e/100*q/365);
s1=s1*(1+g/100);
}
else if(q==365)
{
s1=y*(1+f/100);
s1=s1*(1+g/100);
}
s2=y*(1+f/100*(q+365)/365);
printf("%.1lf %.1lf ",s1,s2);
}
}
return 0;
}

参数
15MS 264K 708 B

原文地址:https://www.cnblogs.com/liudehao/p/4118435.html