【21】 program
Title: Monkey eating peach issues: the monkey off his first day of a number of peach, half eaten immediately, not addiction, but also eat one, and the next morning in turn eaten by the remaining peach half, then eat one. Eat the morning after the remaining half of the previous day zero one. To 10 days when the morning to eat, see only one peach was. Abstract seeking total number of the first day.
1. Program analysis: to reverse the methods of thinking, inferred from back to front.
2. Program source code: main ()
(
int day, x1, x2;
day = 9;
x2 = 1;
while (day> 0)
(
x1 = (x2 + 1) backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp 2; / bin / boot / dev / etc / home / lib / lost + found / media / misc / mnt / net / opt / proc / root / sbin / selinux / srv / sys / tmp / u01 / usr / var / vmware first day of the first two days the number of peaches peaches add 1 to the number of 2 times the backup / bin / conf / data / log / maint / svn / tmp /
x2 = x1;
day -;
)
printf ("the total is% dn", x1);
)