leetcode970
Posted AsenYang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode970相关的知识,希望对你有一定的参考价值。
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(); } }
以上是关于leetcode970的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode 970. Powerful Integers
Leetcode 970. Powerful Integers
Leetcode_easy970. Powerful Integers
leetcode970. Powerful Integers
LeetCode.970-强大的整数(Powerful Integers)
leetcode_1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_[二维前缀和](代码片段