public class Solution { public IList<int> PowerfulIntegers(int x, int y, int bound) { var list = new List<int>(); for (int i = 0; i < bound; i++) { for (int j = 0; j < bound; j++) { var num = Math.Pow((double)x, (double)i) + Math.Pow((double)y, (double)j); if (num <= bound) { list.Add((int)num); } else { if (j == 0) { return list.Distinct().OrderBy(a => a).ToList(); } else { break;//换行 } } } } return list.Distinct().OrderBy(a => a).ToList(); } }