View Code of Problem 64

#include<stdio.h>
//#include<math.h>
//#include<string.h>
int main() {
 int N,k,L;
 int i;
 while(scanf("%d %d %d",&N,&k,&L)!=EOF) {
  if(N==0&k==0&&L==0) break;

  for(i=2; i<N; i++) {
   if(k-k/2+k>L)  break;
   else
   k=k-k/2+k;
  }
  printf("%d\n",k);
 }

 return 0;
}

Double click to view unformatted code.


Back to problem 64