We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原题链接: 1237. 找出给定方程的正整数解
解题思路:
1 <= x, y <= 1000
x
y
customfunction.f(x, y) === z
/** * @param {CustomFunction} customfunction * @param {integer} z * @return {integer[][]} */ var findSolution = function(customfunction, z) { let result = [] // 存储结果 // 枚举所有x,y,并使用函数计算结果 for (let x = 1; x <= 1000; x++) { for (let y = 1; y <= 1000; y++) { // 如果计算结果等于z,就存储x,y if (customfunction.f(x, y) === z) { result.push([x, y]) } } } return result };
复杂度分析:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原题链接:
1237. 找出给定方程的正整数解
解题思路:
1 <= x, y <= 1000
,因此可以暴力枚举所有x
和y
,提供给函数计算customfunction.f(x, y) === z
的结果全部存储并返回即可复杂度分析:
The text was updated successfully, but these errors were encountered: