#include <stdio.h> #define MAX 20 int main() { int money=MAX; int count=MAX; while(1) { if(money%2!=0) { count=count+money-1; break; } else { money=money/2; count+=money; } } printf("%d\n",count); return 0; }
时间: 2024-12-28 00:57:25
#include <stdio.h> #define MAX 20 int main() { int money=MAX; int count=MAX; while(1) { if(money%2!=0) { count=count+money-1; break; } else { money=money/2; count+=money; } } printf("%d\n",count); return 0; }