Baby Step, Giant Step

  • + 0 comments

    int solve(int a, int b, int d) { if(d==0) return 0; else if(d==a || d==b) return 1; else { if((d-b)%b==0) return (d-b)/b+1; else return (d-b)/b+2; } }