Advertisement
Guest User

Kolbi

a guest
Dec 11th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Kolbi
  6. {
  7. class Kolbi
  8. {
  9. static void Main(string[] args)
  10. {
  11. double[] input = Console.ReadLine().Split(new char[] { ' ' },StringSplitOptions.RemoveEmptyEntries).Select(double.Parse).ToArray();
  12. double numOfColbes = input[0];
  13. double volume = input[1];
  14. double[] volumes = new double[(int)numOfColbes + 1];
  15. volumes[0] = 0;
  16. volumes[1] = 1;
  17.  
  18. if (volume > 1)
  19. {
  20. for (int i = 2; i <= numOfColbes; i++)
  21. {
  22.  
  23. volumes[i] = i - 1 + volumes[i - 1];
  24. if (volume <= volumes[i])
  25. {
  26. if (i % 2 != 0)
  27. {
  28. Console.WriteLine(i);
  29.  
  30. break;
  31. }
  32. }
  33.  
  34. }
  35. }
  36. else if (volume > 0 && volume <=1)
  37. {
  38. Console.WriteLine("3");
  39. }
  40.  
  41.  
  42.  
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement