for zhou in range(5):
for zhang in range(8):
if 3*zhou +4*zhang==25:
print 2*zhang+zhou, zhou+zhang, zhang, zhou
break
结果:11 7 4 3
我觉着,这个应该这样解决比较符合计算机解题思路。
下面的回答的,思考的东西太多。
# -*- coding: utf-8 -*-
__author__ = 'lpe234'
__date__ = '2015-04-05'
for wang in range(26):
for li in range(26):
for zhang in range(26):
for zhou in range(26):
if wang + li + zhang + zhou == 25 and wang > li > zhang > zhou and wang == li + zhang and li == zhang + zhou:
print wang
else:
continue
输出:
11