Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace scaleFocus
- {
- using System.Linq;
- public class Program
- {
- public static void Main(string[] args)
- {
- int[] bouquetsNums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int p = int.Parse(Console.ReadLine());
- int leftover = 0;
- bool finished = false;
- int roses = 0;
- while (!finished)
- {
- foreach (var t in bouquetsNums)
- {
- leftover++;
- roses += t;
- }
- roses += p;
- if (leftover >= p)
- {
- leftover -= p;
- roses += p;
- }
- finished = leftover == 0;
- }
- Console.WriteLine(roses);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment