Jul 16, 2023

Hints 0

A: Flip Five

B: Checkmate in One

C: Smallest Multiple

Below is a minimal Python program that solves A+B with big integers, one integer per line. Note that certain input/output methods may be faster than others and may be preferred in contests:

import sys inputs = sys.stdin.read().splitlines() A, B = map(int, inputs) sys.stdout.write(str(A + B) + '\n')

Below is a minimal Java program that solves A+B with big integers, one integer per line. Note that certain input/output methods may be faster than others and may be preferred in contests:

// Main.java import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public void tokenize() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { String line = reader.readLine(); tokenizer = new StringTokenizer(line); } catch (IOException e) { throw new RuntimeException(e); } } } public String next() { tokenize(); return tokenizer.nextToken(); } public String nextLine() { tokenize(); return tokenizer.nextToken(""); } public BigInteger nextBigInteger() { return new BigInteger(next(), 10); /* radix */ } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } } public static void main(String[] args) { InputReader in = new InputReader(System.in); BigInteger A = in.nextBigInteger(); BigInteger B = in.nextBigInteger(); System.out.println(A.add(B)); } }