C++真是太难用了,还是Java和Python好用。

Integer Inquiry

https://www.nowcoder.com/practice/df03906024d742cc919a64c22983f5e1

//Java版代码
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger sum = BigInteger.ZERO;
        BigInteger a;
        do {
            a = sc.nextBigInteger();
            sum = sum.add(a);
        } while (!a.equals(BigInteger.ZERO));
        System.out.println(sum);
    }
}
#Python版代码
a = int(input())
sum = a
while a:
    a = int(input())
    sum += a
print(sum)

全部评论

相关推荐

Hyh_111:像这种hr就不用管了,基本没啥实力,换一个吧
点赞 评论 收藏
分享
选钝角的小学生很热爱...:佬,今天收到的嘛?我三面结束二十天了,没人联系😅。请问你base哪里啊
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务