View Code of Problem 64

#include <iostream>
using namespace std;
int main() {
	int n,p,m;
	while(cin>>n>>p>>m) {
		if(n==0&&p==0&&m==0)
			break;
		
		for(int i=2; i<n; i++) {
			if(p-p/2+p>m)
				break;
			p=p-p/2+p;
		}
		cout<<p<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 64