This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Author : Md.Mehadi Hasan Menon. | |
* Problem : 12157 - Tariff Plan. | |
* Status : Accepted. | |
* Date : 09-11-2014. | |
**/ | |
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
int tCase, n, i, j, cnt1, cnt2, a, b, nCall[25]; | |
float sum1, sum2; | |
scanf("%d", &tCase); | |
for(j = 1; j <= tCase; j++) | |
{ | |
scanf("%d", &n); | |
for(i = 0; i < n; i++) | |
scanf("%d", &nCall[i]); | |
cnt1 = 0; | |
cnt2 = 0; | |
for(i = 0; i < n; i++) | |
{ | |
sum1 = 1; | |
sum2 = 1; | |
a = nCall[i] - 29; | |
if(a > 0) | |
sum1 = sum1 + ceil(a / 30.0); | |
b = nCall[i] - 59; | |
if(b > 0) | |
sum2 = sum2 + ceil(b / 60.0); | |
cnt1 += sum1; | |
cnt2 += sum2; | |
} | |
cnt1 = cnt1 * 10; | |
cnt2 = cnt2 * 15; | |
printf("Case %d: ", j); | |
if(cnt1 < cnt2) | |
printf("Mile %d\n", cnt1); | |
else if(cnt1 > cnt2) | |
printf("Juice %d\n", cnt2); | |
else | |
printf("Mile Juice %d\n", cnt1); | |
} | |
return 0 | |
} |
Comments
Post a Comment