HackerRank/JAVA

Java BigInteger

예쁜꽃이피었으면 2024. 1. 22. 16:59

https://www.hackerrank.com/challenges/java-biginteger/problem?isFullScreen=true

 

Java BigInteger | HackerRank

Learn to handle huge integers using Java Biginteger class.

www.hackerrank.com

 

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        
        Scanner sc = new Scanner(System.in);
        BigInteger a = new BigInteger(sc.nextLine());
        BigInteger b = new BigInteger(sc.nextLine());
        
        System.out.println(a.add(b));
        System.out.println(a.multiply(b));
        
    }
}

 

 

 


 

 

 

 

반응형