• java大整数


    1:首先要引入这个包

    import java.math.BigInteger;
    

    2: 定义

    和普通的定义没有什么区别

    BigInteger[] dp = new BigInteger[300];
    BigInteger x;
    

    3:初始化

    java不能直接用“=”赋值

    如果要初始化为temp

    x=BigInteger.valueOf(temp);
    

    4:运算

    加法

    BigInteger x=BigInteger.valueOf(1);
    BigInteger y=BigInteger.valueOf(2);
    BigInteger z=x.add(y);
    System.out.println(z);
    

    这里代表

    (z=x+y)

    其他运算

    BigInteger add(BigInteger other)

    BigInteger substact(BigInteger other)

    BigInteger multiply(BigInteger other)

    BigInteger divide(BigInteger other)

    BigInteger mod(BigInteger other)

    5:输入输出

    输入输出和普通的没什么区别

    x =cin.nextBigInteger();
    System.out.println(x);
    
    卷也卷不过,躺又躺不平
  • 相关阅读:
    USACO Spinning Wheels
    USACO Agri-Net
    NOIP 2009 最优贸易
    USACO Cow Contest
    USACO Subset Sums
    USACO Cow Cars
    USACO Making the Grade
    NOIP 2008 传纸条
    NOIP 2000 方格取数
    NOIP 1999 导弹拦截
  • 原文地址:https://www.cnblogs.com/hunxuewangzi/p/14490875.html
Copyright © 2020-2023  润新知