Sunday, April 24, 2016

UVA 12157 - Tariff Plan : Solution

Unknown
#include <stdio.h>
int main()
{
    int t,c=1,n,a,mile,juice;
    scanf("%d",&t);
    while (t--)
    {
        scanf("%d",&n);
        int mile=0, juice=0;
        while (n--)
        {
            scanf("%d",&a);
            mile+=((a/30)+1)*10;
            juice+=((a/60)+1)*15;
        }
        printf("Case %d: ",c++);
        if (mile<juice)
            printf("Mile %d\n",mile);
        else if (juice<mile)
            printf("Juice %d\n",juice);
        else
            printf("Mile Juice %d\n",mile);
          
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,