#include<iostream> #include<cstring> #include<string.h> using namespace std; int main(){ int station,sum,p; while(~scanf("%d%d%d",&station,&p,&sum)){ if(sum == 0 && station == 0 && p == 0)break; for(int i = 1;i < station - 1;i++){ if(p-p/2+p > sum)break; p = p - p / 2 + p; } printf("%d\n",p); } return 0; } |
Double click to view unformatted code.