24小时热门版块排行榜    

查看: 1114  |  回复: 5
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

天一柯南

禁虫 (著名写手)

本帖内容被屏蔽

» 猜你喜欢

已阅   关注TA 给TA发消息 送TA红花 TA的回帖

nk_huaxue

金虫 (小有名气)

nono2009: 屏蔽内容 2016-02-25 19:55:18
本帖内容被屏蔽

4楼2016-02-25 00:52:57
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 6 个回答

nk_huaxue

金虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
天一柯南: 金币+20, 有帮助 2016-02-24 23:52:57
def fullarrangement(alist):
    '''
    input is a list containing all the elements for full arrangement analysis
    output is a list containing all the arrangement results
    output also shows how many ways to arrange all the elements
    all the outputs are included in one list
    '''
    n = len(alist)
    list1 = []
   
    for i in range(0, n):
        newlist = alist[0:i] + alist[i+1:]
        for j in range(0, n-1):
            str1 = ""
            str1 += alist
            for k in range(j, n-1):
                str1 += newlist[k]
            for m in range(0, j):
                str1 += newlist[m]
            list1.append(str1)
   
    return [list1, len(list1)]

a = fullarrangement(["a", "b", "c"])
print(a)
2楼2016-02-24 11:43:56
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

nk_huaxue

金虫 (小有名气)

中间有一行copypaste丢了一点儿
更正在下面:
str1 += alist
3楼2016-02-25 00:51:39
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

nk_huaxue

金虫 (小有名气)

str1 += alist这句alist后面应该有个(中括号i)
5楼2016-02-25 00:55:00
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 085600材料与化工调剂 +7 A-哆啦Z梦 2026-03-23 12/600 2026-03-23 23:16 by 星空星月
[考研] 335分 | 材料与化工专硕 | GPA 4.07 | 有科研经历 +4 cccchenso 2026-03-23 4/200 2026-03-23 23:00 by 徐ckkk
[考研] 284求调剂 +3 yanzhixue111 2026-03-23 6/300 2026-03-23 22:58 by pswait
[考研] 化学308分求调剂 +3 你好明天你好 2026-03-23 3/150 2026-03-23 20:11 by macy2011
[考研] 263求调剂 +6 yqdszhdap- 2026-03-22 9/450 2026-03-23 12:57 by yqdszhdap-
[考研] 315分,诚求调剂,材料与化工085600 +3 13756423260 2026-03-22 3/150 2026-03-22 20:11 by edmund7
[考研] 一志愿华中农业071010,总分320求调剂 +5 困困困困坤坤 2026-03-20 6/300 2026-03-22 17:41 by hxsm
[考研] 化学调剂 +5 yzysaa 2026-03-21 5/250 2026-03-21 22:12 by peike
[考研] 材料与化工(0856)304求B区调剂 +3 邱gl 2026-03-20 7/350 2026-03-21 19:05 by 15709483992
[考研] 求调剂 +4 要好好无聊 2026-03-21 4/200 2026-03-21 18:57 by 学员8dgXkO
[考研] 268求调剂 +9 简单点0 2026-03-17 9/450 2026-03-21 15:37 by lature00
[考研] 求调剂 +6 Mqqqqqq 2026-03-19 6/300 2026-03-21 08:04 by JourneyLucky
[考研] 265求调剂 +3 Jack?k?y 2026-03-17 3/150 2026-03-21 03:17 by JourneyLucky
[考研] 294求调剂材料与化工专硕 +15 陌の森林 2026-03-18 15/750 2026-03-20 23:28 by JourneyLucky
[考研] 304求调剂 +7 司空. 2026-03-18 7/350 2026-03-20 23:08 by JourneyLucky
[考研] 329求调剂 +9 想上学吖吖 2026-03-19 9/450 2026-03-20 22:01 by luoyongfeng
[考研] 求调剂 +3 eation27 2026-03-20 3/150 2026-03-20 19:32 by JourneyLucky
[考研] 一志愿南理工085701环境302求调剂院校 +3 葵梓卫队 2026-03-20 3/150 2026-03-20 19:28 by zhukairuo
[考博] 申博26年 +3 八6八68 2026-03-19 3/150 2026-03-19 19:43 by nxgogo
[考研] 0703化学调剂 +5 pupcoco 2026-03-17 8/400 2026-03-19 13:58 by houyaoxu
信息提示
请填处理意见