Advertisement
CodingSolving

Untitled

Jul 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Profit
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int r = int.Parse(Console.ReadLine());
  14. int s = int.Parse(Console.ReadLine());
  15. int c = int.Parse(Console.ReadLine());
  16. int maxQuantity = int.Parse(Console.ReadLine());
  17.  
  18. double calculate = 0;
  19. double rasp = 1;
  20. double straw = 1;
  21. double cherr = 1;
  22.  
  23. for (int i = 1; i <=r; i++)
  24. {
  25.  
  26. for (int j = 1; j <=s; j++)
  27. {
  28.  
  29. for (int k = 1; k <=c; k++)
  30. {
  31.  
  32. calculate = (i * 15) + j * (7.5)+(k*4.5);
  33. if (calculate == maxQuantity - 1)
  34. {
  35. Console.WriteLine($"{calculate}");
  36. return;
  37. }
  38. else if (calculate == maxQuantity)
  39. {
  40. Console.WriteLine(calculate);
  41. return;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement