# -*- coding:utf-8 -*-
for cock in range(1,20+1):
for hen in range(1,33+1):
for biddy in range(1,99+1):
if (5*cock+3*hen+biddy/3)==100:
if (cock+hen+biddy)==100:
if biddy%3==0:
print "百钱买百鸡的答案为:"
print cock,hen,biddy
@echo off
setlocal enabledelayedexpansion
for /l %%i in (0,1,20) do (
for /l %%j in (0,1,33) do (
for /l %%k in (0,2,100) do (
set /a money=5*%%i+3*%%j+%%k/2
set /a chook=%%i+%%j+%%k
if !money! equ !chook! if !money! equ 100 (
set /a num+=1
echo !num!: %%i+%%j+%%k
)
)
)
)
echo 百钱买百鸡,共有 %num% 种买法。
pause