Advertisement
Guest User

Student Cable

a guest
Jul 19th, 2014
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         int n = int.Parse(Console.ReadLine());
  10.         int result = 0;
  11.  
  12.         for (int i = 0; i < n; i++)
  13.         {
  14.             int numCables = int.Parse(Console.ReadLine());
  15.             string cabType = Console.ReadLine();
  16.  
  17.             if (cabType == "meters")
  18.             {
  19.                 numCables *= 100;
  20.             }
  21.             if (numCables >= 20)
  22.             {
  23.                 result += numCables - 2;
  24.             }
  25.         }
  26.  
  27.  
  28.          int counter = 0;
  29.          int leftResult = result;
  30.          for (int i = result; i > 504; i -= 504)
  31.          {
  32.         counter++;
  33.             leftResult -= 504;
  34.          }
  35.          
  36.  
  37.         Console.WriteLine(counter);
  38.         Console.WriteLine(leftResult);
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement