public void TestExponentialNumberSuccess(string text, string remainingText) { IMatch matchNumber = new Numb().Match(text); //Assert.True(matchNumber.Success()); Assert.Equal(remainingText, matchNumber.RemainingText()); }
public static IEnumerable<Numb> MatchText(string text) { var ns = new List<Numb>(); for (Match match = Regex.Match(text, @">\s*(M\s*.{2}\d{3,4})\s*</"); match.Success; match = match.NextMatch()) { var result = new Numb(match.Groups[1].Value); Console.Out.WriteLine("-> {0}", result); ns.Add(result); } return ns; }
protected override void DoCast() { GetEnemyTarget(); TargetTakeDamage(); if (unit.powerAttckEffectCounter >= 15) { Numb numb = new Numb(unit); TargetApplyBuff(unit, new List <Buff>() { numb }); unit.powerAttckEffectCounter -= 15; } }
public int solution(int[] A, int X) { int ret = 0; if (A.Length ==0) return 0; Array.Sort(A); Numb[] Xc = new Numb[A.Length]; int j = 0; Xc[j] = new Numb(); Xc[j].val = A[0]; int valid = 0; bool flag = false; for (int i = 0; i < A.Length; i++) { if (Xc[j].val == A[i]) { Xc[j].count++; if (Xc[j].count >= 2 && flag == false) { flag = true; valid++; } } else { flag = false; j++; Xc[j] = new Numb(); Xc[j].val = A[i]; Xc[j].count++; } } Numb[] Y = new Numb[valid]; int k = 0; for (int i = 0; i < Xc.Length; i++) { if (Xc[i] == null) break; if (Xc[i].count > 1) { Y[k] = new Numb(); Y[k] = Xc[i]; k++; } } int down = Y.Length - 1; for (int i = 0; i < Y.Length; i++) { int me = Y[i].val; while (i <= down && (double)(Y[down].val * me) >= X) { down--; } if (down >= i) { ret = ret + Y.Length - 1 - down; } else { if (Y[i].count >= 4) ret = ret + 1; ret = ret + Y.Length - 1 - i; } if (ret > 1000000000) return -1; } string g = ""; for (int i = 0; i < A.Length; i++) { g = g + "," + A[i]; } Console.WriteLine(g + "|" + X); return ret; }
public string Info() { return(Numb.ToString() + Cost.ToString() + Date + Row.ToString() + Seat.ToString() + Place + Vacant + Name); }
public int solution(int[] A, int X) { int ret = 0; if (A.Length == 0) { return(0); } Array.Sort(A); Numb[] Xc = new Numb[A.Length]; int j = 0; Xc[j] = new Numb(); Xc[j].val = A[0]; int valid = 0; bool flag = false; for (int i = 0; i < A.Length; i++) { if (Xc[j].val == A[i]) { Xc[j].count++; if (Xc[j].count >= 2 && flag == false) { flag = true; valid++; } } else { flag = false; j++; Xc[j] = new Numb(); Xc[j].val = A[i]; Xc[j].count++; } } Numb[] Y = new Numb[valid]; int k = 0; for (int i = 0; i < Xc.Length; i++) { if (Xc[i] == null) { break; } if (Xc[i].count > 1) { Y[k] = new Numb(); Y[k] = Xc[i]; k++; } } int down = Y.Length - 1; for (int i = 0; i < Y.Length; i++) { int me = Y[i].val; while (i <= down && (double)(Y[down].val * me) >= X) { down--; } if (down >= i) { ret = ret + Y.Length - 1 - down; } else { if (Y[i].count >= 4) { ret = ret + 1; } ret = ret + Y.Length - 1 - i; } if (ret > 1000000000) { return(-1); } } string g = ""; for (int i = 0; i < A.Length; i++) { g = g + "," + A[i]; } Console.WriteLine(g + "|" + X); return(ret); }