#include <stdio.h> int foo(int day) { if(day == 1) return 2; else return foo(day -1) * 2 + 2; } int main(void) { printf("第一天共有%d个瓜\n", foo(5)); return 0; }
#include <stdio.h> int main( void ) { const unsigned n = 5; printf( "第一天共有%u个瓜\n", (1u<<(n+1))-2 ); return 0; }