题解 | #尼科彻斯定理#

尼科彻斯定理

http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85

def myfunc(x):
    result = []
    y = int(pow(x, 3) / x)
    if x % 2 == 0:
        for i in range(x//2):
            temp_1 = y - 1 - 2*i
            result.append(temp_1)
            temp_2 = y + 1 + 2*i
            result.append(temp_2)
    else:
        result.append(y)
        for i in range(x//2):
            temp_1 = y - 2 - 2*i
            result.append(temp_1)
            temp_2 = y + 2 + 2*i
            result.append(temp_2)
    return result

while True:
    try:
        a = int(input())
        b = myfunc(a)
        b.sort()
        print(*b,sep="+")
    except:
        break
全部评论

相关推荐

xdm怎么说 要被拷打了 担心是KPI
丹田:面就完了,就当日薪四位数的大佬免费给给你面试。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务