#include<iostream> using namespace std; int main(){ int n; int k; int l; while(cin>>n>>k>>l,n!=0||k!=0||l!=0){ for(int i=2;i<n;++i){ int temp=k; if(k-k/2+temp>l){ break; } else { k=k-k/2; k+=temp; } } cout<<k<<endl; } return 0; } |
Double click to view unformatted code.