Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class StudentCables
- {
- static void Main()
- {
- int cables = int.Parse(Console.ReadLine());
- // all variables can be int
- int sumOfCables = 0;
- // stores how many cables we actually use after losing the short ones
- int used = cables;
- for (int i = 0; i < cables; i++)
- {
- int cableLength = int.Parse(Console.ReadLine());
- string measure = Console.ReadLine();
- if (measure == "meters")
- {
- cableLength = cableLength * 100;
- }
- if (cableLength < 20 && measure != "meters")
- {
- cableLength = 0;
- used--;
- }
- sumOfCables = sumOfCables + cableLength;
- }
- // the amount we cut depends on the number of cables actually used
- sumOfCables = sumOfCables - (used - 1) * 3;
- int countCables = sumOfCables / 504;
- int remainder = sumOfCables % 504; // simpler way to get the remainder
- Console.WriteLine(countCables);
- Console.WriteLine(remainder);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement