Advertisement
juanjo12x

UVA_12157_Tariff_Plan

Jun 11th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char** argv) {
  5.     int t,n,i,cont,duracion,costmile,costjuice,time;
  6.     cont=0;
  7.     scanf("%d",&t);
  8.     while(t--){
  9.         cont++;
  10.         costmile=0;costjuice=0;time=0;
  11.         scanf("%d",&n);
  12.         for(i=0;i<n;i++){
  13.         time=0;
  14.         scanf("%d",&duracion);    
  15.         /*Mile---*/
  16.         while(time<=duracion){
  17.             time+=30;
  18.             costmile+=10;
  19.         }
  20.         time=0;
  21.         while(time<=duracion){
  22.             time+=60;
  23.             costjuice+=15;
  24.         }
  25.        
  26.        
  27.         }
  28.         if(costmile<costjuice){
  29.             printf("Case %d: Mile %d\n",cont,costmile);
  30.         }else if(costjuice<costmile){
  31.             printf("Case %d: Juice %d\n",cont,costjuice);
  32.         }else{
  33.             printf("Case %d: Mile Juice %d\n",cont,costjuice);
  34.         }
  35.     }
  36.     return (EXIT_SUCCESS);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement