fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x[30],n;
  5. x[1]=1;
  6. for(n=2;n<30;n++){
  7. x[n]=2*x[n-2]+1;
  8. }
  9. while(x[n]<1000){
  10. n++;
  11. }
  12. printf("%d",n);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
35