Guest User

02.Student Cables

a guest
Apr 14th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Numerics;
  6. using System.Threading.Tasks;
  7.  
  8. class Program
  9. {
  10.     static void Main()
  11.     {
  12.         int n = int.Parse(Console.ReadLine());
  13.         long totalLength = 0;
  14.         int cablecount = n;
  15.         for(int i = 0;i<n;i++)
  16.         {
  17.             int length = int.Parse(Console.ReadLine());
  18.             string measure = Console.ReadLine();
  19.             if(measure == "meters")
  20.             {
  21.                 length = length * 100;
  22.             }
  23.             if(length>=20)
  24.             {
  25.                 totalLength += length;
  26.             }
  27.             else if(length<20)
  28.             {
  29.                 cablecount--;
  30.             }
  31.         }
  32.         totalLength -= (cablecount - 1) * 3;
  33.         Console.WriteLine(totalLength/504);
  34.         Console.WriteLine(totalLength%504);
  35.  
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment