Created
April 2, 2019 07:58
-
-
Save panyan928/24f76770cf29c5401d858cc6f24f062f to your computer and use it in GitHub Desktop.
microsoft_sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserMainCode(object): | |
@classmethod | |
def series(cls, input1, input2, input3): | |
cls.count=0 | |
def dfs(now, sum, num): | |
print(now) | |
if num == input2 - 1: | |
if now[-1] < input1 - sum <= now[-1] + input3: | |
print(now, sum, num) | |
cls.count += 1 | |
return | |
for i in range(now[-1]+1, now[-1] + input3 + 1): | |
if sum + i <= input1: | |
now.append(i) | |
dfs(now, sum+i, num+1) | |
now.pop(-1) | |
dfs([0], 0, 0) | |
print(cls.count) | |
return cls.count | |
Author
panyan928
commented
Apr 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment