Last active
July 6, 2021 13:58
-
-
Save tokugh/1dc514eb878bdd8bc4cd32ab9441edc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MOD: i128 = 1_000_000_007; | |
fn main() { | |
proconio::input!{ l: i128, r: i128, }; | |
let mut ans = 0; | |
for i in 0..=18 { | |
let min = 10i128.pow(i).max(l); | |
let max = (10i128.pow(i + 1) - 1).min(r); | |
if min <= max { | |
ans += (i as i128 + 1) * (min + max) * (max - min + 1) / 2; | |
ans %= MOD; | |
} | |
} | |
println!("{}", ans); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment