100塊錢買100只雞,大雞5元1只,小雞1元2只,請問有多少買法,用turbo c編程計算
http://codepad.org/qLUf1gXH
1 190
2 180
3 170
4 160
5 150
6 140
7 130
8 120
9 110
10 100
11 90
12 80
13 70
14 60
15 50
16 40
17 30
18 20
19 10
#include<stdio.h>
int main()
{
for (int i = 0; i < 20; i++)
for (int j = 0; j < 200; j += 2)
if (j / 2 + i * 5 == 100) printf("%d %d\n", i, j);
}