The code you provided has a syntax error on line 10. The opening parenthesis "(" does not have a matching closing parenthesis ")".

To fix this error, you can add a closing parenthesis after the end of the while loop, like this:

let ans = 
    seq { num1..num2 }
    |> Seq.filter (fun x -> 
        let mutable j = x
        let mutable containsTwo = false
        while j > 0 && not containsTwo do
            if j % 10 = 2 then
                containsTwo <- true
            j <- j / 10
        containsTwo // <-- Add closing parenthesis here
    })
    |> Seq.length

This will resolve the syntax error and allow the code to compile and run correctly

open Systemlet input = ConsoleReadLinelet nums = inputSplit let num1 = Int32Parsenums0let num2 = Int32Parsenums1let ans = seq num1num2 Seqfilter fun x - let mutable j = x let

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

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