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