Files
2023-02-21 10:56:54 +08:00

12 lines
427 B
C

#include <stdio.h>
int main() {
int apple[6] = {0};
int childCount = 4;
apple[5] = 11;
for (;childCount > 0; childCount--) {
apple[childCount] = (apple[childCount+1] * (childCount + 1) + 1)/childCount;
}
printf("Total number of apple: %d\n 1: %d\n 2: %d\n 3: %d\n 4: %d\n 5: %d\n", apple[1], apple[1]-apple[2], apple[2]-apple[3], apple[3]-apple[4], apple[4]-apple[5], apple[5]);
return 0;
}