SIMBIRD - Editorial

PROBLEM LINK:

Contest

Author: thvardhan

Tester: thvardhan

DIFFICULTY:

Easy

PREREQUISITES:

Arbitrary-precision arithmetic

PROBLEM:

You are given a big input probably near 10^200. you have to take that input and output the same thing +1

QUICK EXPLANATION:

As Long long integer cant keep this big digit we simply use BigIntegers.(java)

EXPLANATION:

We use a BigInteger class to solve this problem. BigIntegers can hold 10^200 digit long digits.
So here we make a object of BigInteger

BigInteger int=new BigInteger("1");

the 1 we passed in the constructor means the initial value of this big integer will be 1.Now we just take input from console from either scanner or bufferedreader as a string.And then we add both integers with

int.add(new BigInteger(i));

note we use strings not integers to store this big digit. here i denotes a String we got from console. and now we just print it back to console using

System.out.println(int);

AUTHOR’S SOLUTION:

author’s solution can be found here

//