fork download
  1. using System;
  2. using System.IO;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string writePath = "shelf.out";
  9. float N = Convert.ToInt32(Console.ReadLine());
  10. float W = Convert.ToInt32(Console.ReadLine());
  11. float L = Convert.ToInt32(Console.ReadLine());
  12.  
  13. int kolovo = 0;
  14. while(L > 0) {
  15. if(W > L) {
  16. if(L/W > 0.5f) {
  17. L -= W;
  18. kolovo ++;
  19. } else {
  20. L -= W;
  21. }
  22.  
  23. }else {
  24. L -= W;
  25. kolovo ++;
  26. }
  27. }
  28. kolovo ++;
  29. if(kolovo > N) {
  30. kolovo = (int)N;
  31. }
  32. using (StreamWriter sw = new StreamWriter(Path.Combine(writePath, "shelf.out")))
  33. // using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding.Default))
  34. {
  35. sw.WriteLine(kolovo);
  36. }
  37.  
  38.  
  39.  
  40. }
  41. }
Success #stdin #stdout 0.02s 16008KB
stdin
2
2
2
stdout
2