[HDU] [1994] Interest Calculation

Problem Description

Loading...

Problem Analysis

This was supposed to be a freebie problem, but seeing all those numbers plus a bit of showing off, my brain short-circuited and I went for the second problem instead, then got stuck, which ruined my mood for the whole contest. This time I wrote it and got an instant AC on this one -.-

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
int main() {
	int T;
	double Y,Q,e,f,g;
	scanf("%d",&T);
	while(T--) {
		scanf("%lf %lf %lf %lf %lf",&Y,&Q,&e,&f,&g);
		double sum1=0,sum2;
		sum1=Y*(1+e/100*Q/365);
		if(Q>=100) {
			sum1=sum1*(1+g/100);
		} else {
			sum1=sum1*(1+f/100);
		}
		sum2=Y*(1+f/100*(Q+365)/365);
		printf("%.1lf\n%.1lf\n",sum1,sum2);
	}
	return 0;
}

Problem link: 【HDU】[1994] Interest Calculation

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...