用for循环来做!!!

解决方案 »

  1.   

    !(x<y+z) || !(x+10<=20)随便问下前面加的“!”是什么意思哦!!
      

  2.   

    x(n+1)=x(n)*2+1!表示逻辑非true变flase,false变true
      

  3.   

    public static void main(String[] args) {
    int max = (1 << 10) - 1;
    BigInteger TWO = BigInteger.valueOf(2);
    BigInteger tmp = new BigInteger("0");
    BigInteger sum = tmp;
    for (int i = 0; i < max; i++) {
    tmp = tmp.multiply(TWO).add(BigInteger.ONE);
    System.out.println(tmp);
    sum = sum.add(tmp);
    }
    System.out.println(sum);
    }一直加到2的10次方,数字太大了... 前面加!标示对逻辑运行求反,把true变成false; false变成true.
      

  4.   

    意思就是本来输出结果是true,如果前面加了! 那么就变成输出flase?
      

  5.   

    真的否定不就是假咯...
    所以true的否定(!)就是false了..
      

  6.   

    double result=0.0;
    for(int i=1;i<=10;i++)
    {
       result+=Math.pow(2,i)-1.0;
    }System.out.println(result);
      

  7.   


    int result=0; 
    for(int i=1;i <=10;i++) 

      result += (1 << i) - 1; 
    }  System.out.println(result);
      

  8.   

    2+4+8+16+32...+2^10 - 1*10
    前面的每个数先+1 最后再减10 
    。。
    这道数学题  so easy
      

  9.   

    2^0+2^1+2^2+……+2^n 数学公式2^(n+1)-1
    楼主的题如果不用for循环可以用
    return (1 << 11) - 12 ;
    效率比for快多了
      

  10.   


    -------------------------------------
    http://www.pkwutai.cn
      

  11.   

    等比数列求和!
    (2^1-1)+(2^2-1)+……+(2^n-1)=2*(2^n-1)-n
    n=10,所以:2*(2^10-1)-10=2^11-12LZ需要for,所以移位。long data = 1L;
    for(int i=0;i<11;i++) {
      data<<=1;
    }
    data-=12;