Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace No1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int l, n, v, t;
  14. String[] s1;
  15. using (StreamReader r = new StreamReader("input.txt"))
  16. {
  17. s1 = r.ReadLine().Split(' ');
  18. l = int.Parse(s1[0]);
  19. n = int.Parse(s1[1]);
  20. v = int.Parse(s1[2]);
  21. t = int.Parse(s1[3]);
  22. }
  23.  
  24. int length = l / n;
  25. int cur_length = v * t;
  26.  
  27. while (cur_length > l)
  28. {
  29. cur_length -= l;
  30. }
  31.  
  32. int count = cur_length / length + 1;
  33.  
  34. if (count > l)
  35. {
  36. count = l - count;
  37. }
  38.  
  39. using (StreamWriter w = new StreamWriter("output.txt"))
  40. {
  41. w.WriteLine(Math.Abs(count));
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement