#include "stdio.h" #include "math.h" #include "string.h" void main() { int i,j,k; int n,l; int t; for(;scanf("%d%d%d",&n,&k,&l)!=EOF;) { if(n==0&&k==0&&l==0) break; for(i=0;i<n-2;i++){ if(k-k/2+k>l) break; else k=k-k/2+k; } printf("%d\n",k); } } |
Double click to view unformatted code.