use std::io;

fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); let nums: Vec = input .split_whitespace() .map(|s| s.trim().parse().unwrap()) .collect(); let mut num1 = nums[0]; let mut num2 = nums[1]; let mut ans = 0; for i in num1..=num2 { let mut j = i; while j > 0 { if j % 10 == 2 { ans += 1; } j /= 10; } } println!("{}", ans);

open Systemlet mutable input = ConsoleReadLinelet mutable nums = inputSplit let mutable num1 = Int32Parsenums0let mutable num2 = Int32Parsenums1let mutable ans = 0for i in num1num2 do begin

原文地址: https://www.cveoy.top/t/topic/ijMB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录