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