标签:double orderby list() tin int order public bsp tco
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(); } }
标签:double orderby list() tin int order public bsp tco
原文地址:https://www.cnblogs.com/asenyang/p/10302632.html