#include<bits/stdc++.h>
using namespace std;
int main()
{
int test,n,mile[100],juice[100],i,j,k,m,mcost,jcost,rem;
cin>>test;
for(k=1;k<=test;k++)
{
mcost=jcost=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>mile[i];
juice[i]=mile[i];
}
for(i=0;i<n;i++)
{
m=((mile[i]-1)/30)+1;
rem=mile[i]%30;
if(rem==0)
{
mile[i]=m+1;
}
else
{
mile[i]=m;
}
}
for(i=0;i<n;i++)
{
m=(juice[i]-1)/60+1;
rem=juice[i]%60;
if(rem==0)
{
juice[i]=m+1;
}
else
{
juice[i]=m;
}
}
for(i=0;i<n;i++)
{
mcost=mcost+mile[i]*10;
jcost=jcost+juice[i]*15;
}
if(mcost<jcost)
printf("Case %d: Mile %d\n",k,mcost);
else if(mcost>jcost)
printf("Case %d: Juice %d\n",k,jcost);
else
printf("Case %d: Mile Juice %d\n",k,mcost);
}
return 0;
}
using namespace std;
int main()
{
int test,n,mile[100],juice[100],i,j,k,m,mcost,jcost,rem;
cin>>test;
for(k=1;k<=test;k++)
{
mcost=jcost=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>mile[i];
juice[i]=mile[i];
}
for(i=0;i<n;i++)
{
m=((mile[i]-1)/30)+1;
rem=mile[i]%30;
if(rem==0)
{
mile[i]=m+1;
}
else
{
mile[i]=m;
}
}
for(i=0;i<n;i++)
{
m=(juice[i]-1)/60+1;
rem=juice[i]%60;
if(rem==0)
{
juice[i]=m+1;
}
else
{
juice[i]=m;
}
}
for(i=0;i<n;i++)
{
mcost=mcost+mile[i]*10;
jcost=jcost+juice[i]*15;
}
if(mcost<jcost)
printf("Case %d: Mile %d\n",k,mcost);
else if(mcost>jcost)
printf("Case %d: Juice %d\n",k,jcost);
else
printf("Case %d: Mile Juice %d\n",k,mcost);
}
return 0;
}
No comments:
Post a Comment