Skip to content

Instantly share code, notes, and snippets.

@Tangrila-BG
Created May 27, 2017 09:46
Show Gist options
  • Save Tangrila-BG/ea711d944b4dc40bd46a95402961a3b7 to your computer and use it in GitHub Desktop.
Save Tangrila-BG/ea711d944b4dc40bd46a95402961a3b7 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Csharp.Advanced.StacksAndQueues
{
public partial class StacksAndQueues
{
public static class _05SequenceWithQueue
{
public static void Solution()
{
var n = long.Parse(Console.ReadLine());
var members = 50;
var calcs = new Queue<long>();
var result = new long[50];
calcs.Enqueue(n);
for (int i = 0; i < members; ++i)
{
long current = calcs.Dequeue();
result[i] = current;
calcs.Enqueue(current + 1); // S1
calcs.Enqueue(2 * current + 1); // S2
calcs.Enqueue(current + 2); // S3
}
Console.WriteLine(string.Join(" ", result));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment