Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. class StudentCables
  3. {
  4. static void Main()
  5. {
  6. int lanLength = 504;
  7. int n = int.Parse(Console.ReadLine());
  8. int [] length = new int[n];
  9. string [] measure = new string[n];
  10. int allTogetherLength = 0;
  11. int copyOfN = n;
  12. for (int i = 0; i < copyOfN ; i++)
  13. {
  14. length[i] = int.Parse(Console.ReadLine());
  15. measure[i] = Console.ReadLine();
  16.  
  17. if ( measure[i] == "meters")
  18. {
  19. length[i] = length[i] * 100;
  20. }
  21.  
  22. if ( length[i] < 20 )
  23. {
  24. length[i] = 0;
  25. n = n-1;
  26. }
  27. allTogetherLength = allTogetherLength + length[i];
  28. }
  29.  
  30. int joined = allTogetherLength - 3*(n-1);
  31. int cabelCount = joined / lanLength;
  32. int restCabel = joined % lanLength;
  33. Console.WriteLine(cabelCount);
  34. Console.WriteLine(restCabel);
  35. Console.ReadLine();
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement