-
Notifications
You must be signed in to change notification settings - Fork 2
nine
bradendubois edited this page Nov 8, 2021
·
8 revisions
ID: nine
Difficulty: 3.3
CPU Time: 1 second
Memory: 1024 MB
For each given set of digits d, the total can be calculated as follows: for every position but the left-most, there are 9 (0-8) valid digits, and so one will need to calculate 9 ^ d-1, multipled by 8 (for the 0-8 digits the left-most position can have). To be done in 1 second, oen must implement a fast exponentiation function that mods by 1000000007 to prevent overflow.