Advertisement
nmnikolov

Student Cables

Jul 19th, 2014
194
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. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int result = 0;
  9.         int counter = 0;
  10.  
  11.         for (int i = 0; i < n; i++)
  12.         {
  13.             int numCables = int.Parse(Console.ReadLine());
  14.             string cabType = Console.ReadLine();
  15.  
  16.             if (cabType == "meters")
  17.             {
  18.                 numCables *= 100;
  19.             }
  20.             if (numCables >= 20)
  21.             {
  22.                 result += numCables;
  23.                 counter++;
  24.             }
  25.         }
  26.  
  27.         result -= 3 * (counter - 1);
  28.         counter = 0;
  29.         for (int i = result; i >= 504; i -= 504)
  30.         {
  31.             counter++;
  32.             result -= 504;
  33.         }
  34.         Console.WriteLine(counter);
  35.         Console.WriteLine(result);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement