当前位置:  开发笔记 > 程序员 > 正文

这个算法有什么问题?

如何解决《这个算法有什么问题?》经验,为你挑选了1个好方法。

这是一个抽象的bug形式,它引导我进入构成我之前问题基础的代码.很明显,一旦你看到了它,但是一些熟悉原始问题和原始语言的专业程序员会查看代码并在我们捕获它之前忽略它(不可否认,在它的原生环境中它接近三页长).

请混淆你的回答,以便后来者也能玩得开心.

most_bang_for_buck_score = 0.0
most_bang_for_buck_order = []
for appetizer in appetizers
    total_cost     = appetizer.cost
    total_calories = appetizer.calories
    for salad in salads
        total_cost     = total_cost     + salad.cost
        total_calories = total_calories + salad.calories
        for entree in entrees
            total_cost     = total_cost     + entree.cost
            total_calories = total_calories + entree.calories
            for desert in deserts
                total_cost     = total_cost      + desert.cost
                total_calories = total_calories + desert.calories
                if total_calories/total_cost > most_bang_for_buck_score
                    most_bang_for_buck_score = total_calories/total_cost
                    most_bang_for_buck_order = [appetizer,salad,entree,desert]
 print "You'll get the most food energy for your money ordering ",most_bang_for_buck_order,"\n"

Daniel LeChe.. 6

ROT13(或悬停在此链接上以将非混淆的答案视为工具提示)

V qba'g guvax lbh'er erfrggvat gbgny_pbfg/gbgny_pnybevrf ba rnpu cnff.Lbh bhtug gb whfg或fhzzvat rirelguvat hc bapr va gur vaarezbfg ybbc.

Ol gur jnl lbh fnir gur beqre nf bar bs rnpu vgrz,V'z nffhzvat lbh'er bayl fhccbfrq gb or univat bar bs rnpu sbbq pngrtbel.



1> Daniel LeChe..:

ROT13(或悬停在此链接上以将非混淆的答案视为工具提示)

V qba'g guvax lbh'er erfrggvat gbgny_pbfg/gbgny_pnybevrf ba rnpu cnff.Lbh bhtug gb whfg或fhzzvat rirelguvat hc bapr va gur vaarezbfg ybbc.

Ol gur jnl lbh fnir gur beqre nf bar bs rnpu vgrz,V'z nffhzvat lbh'er bayl fhccbfrq gb or univat bar bs rnpu sbbq pngrtbel.

推荐阅读
mobiledu2402852357
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有