#include<stdio.h> #include<math.h> #include<string.h> #include <stdlib.h> int main() { /* 每天早上都吃了前一天剩下的一半零一个。 到第N天早上想再吃时,见只剩下一个桃子了。求第一天共摘多少桃子。 */ int x = 1; int n ; scanf("%d" , &n); while( n - 1 > 0){ x = ( x + 1 ) * 2; n--; } printf("%d" , x); return 0; } |
Double click to view unformatted code.