/// <summary> /// Rotate the deque n steps. /// </summary> /// <param name="count">Count of rotate to the right. If n is negative, rotate to the left</param> public void Rotate(Int32 count = 1) { if (Count <= 1) { return; } count %= Count; if (count == 0) { return; } Int32 halflen = Count / 2; if (count > halflen || count < -halflen) { } if (count >= 0) { for (Int32 i = 0; i < count; i++) { AddToBack(RemoveFromFront()); } } else { for (Int32 i = 0; i < count.Abs(); i++) { AddToFront(RemoveFromBack()); } } }
public static CultureStrings GetSubTemplate4(out IImmutableList <String> result) { Int32 first = RandomUtils.NextInt32(-20, 30); Decimal second = RandomUtils.NextInt32(2, 10); Decimal answer = second * second - first; result = EnumerableUtils.GetEnumerableFrom(answer.GetString(NumberFormatInfo.CurrentInfo), answer.GetString(NumberFormatInfo.InvariantInfo)).Distinct().ToImmutableArray(); String template = $@"\text{{Найдите корень уравнения }}\sqrt{{x {first.ToSign()} {first.Abs()}}} = {second}"; return(new CultureStrings(template)); }
public static CultureStrings GetSubTemplate2(out IImmutableList <String> result) { Int32 foundation = RandomUtils.NextInt32(2, 8); Int32 first = RandomUtils.NextInt32(-10, 10); Int32 second = RandomUtils.NextInt32(-4, 4); Decimal answer = second - first; result = EnumerableUtils.GetEnumerableFrom(answer.GetString(NumberFormatInfo.CurrentInfo), answer.GetString(NumberFormatInfo.InvariantInfo)).Distinct().ToImmutableArray(); String template; if (second < 0) { template = $@"\text{{Найдите корень уравнения }}{foundation}^{{x {first.ToSign()} {first.Abs()}}} = \frac{{1}}{{{System.Math.Pow(foundation, second.Abs())}}}"; } else { template = $@"\text{{Найдите корень уравнения }}{foundation}^{{x {first.ToSign()} {first.Abs()}}} = {System.Math.Pow(foundation, second)}"; } return(new CultureStrings(template)); }
public static CultureStrings GetSubTemplate5(out IImmutableList <String> result) { Int32 foundation = RandomUtils.NextInt32(2, 6); Int32 first = RandomUtils.NextInt32(-20, 30); Int32 second = RandomUtils.NextInt32(1, 4); Decimal answer = (Decimal)System.Math.Pow(foundation, second) - first; result = EnumerableUtils.GetEnumerableFrom(answer.GetString(NumberFormatInfo.CurrentInfo), answer.GetString(NumberFormatInfo.InvariantInfo)).Distinct().ToImmutableArray(); String template = $@"\text{{Найдите корень уравнения }}log_{{{foundation}}}(x {first.ToSign()} {first.Abs()}) = {second}"; return(new CultureStrings(template)); }