Data Structures & AlgorithmsHardICPC regional · Codeforces Div2 B
Problem: The sum of the digits of 2^100 written in base 10 is computed. What is that sum?
- A. 107
- B. 113
- C. 31
- D. 115
Correct answer: D. 115
2¹⁰⁰ = 1267650600228229401496703205376, whose digits sum to 115 (Python's big integers make this exact). Using 2⁹⁹ gives 107, 2¹⁰¹ gives 113, and 31 is the number of digits, not their sum.
More Coding Interview Problems questions
- Problem: In a spiral traversal of a 5×5 matrix filled row-wise with 1 to 25, the traversal starts at the top-left and goes right, then…
- Problem: A bitmask DP problem: count the subsets of {1, 2, ..., 10} whose sum is a multiple of 5 (the empty set counts, since its sum 0 is…
- Problem: An 8-bit unsigned counter starts at 250 and is incremented by 7 each step, wrapping modulo 256. How many increments until the…
- Problem: The Pascal triangle rows are numbered from row 0 (single 1). What is the sum of all entries in row 12 that are odd?
- Problem: Count the strings of length 4 over the alphabet {a, b, c} that contain no two adjacent equal characters and do not contain the…
- Problem: The number of inversions in a permutation of 1..8 given as [4, 7, 1, 8, 2, 6, 3, 5] is what value?