For problem statement at 1000-1999/1300-1399/1370-1379/1372/problemB.txt this is a correct solution, but verifier at 1000-1999/1300-1399/1370-1379/1372/verifierB.go ends with case 1 failed
input:
1
140893
expected:
140892 1
got:
1 140892
exit status 1 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func smallestPrimeFactor(n int64) int64 {
if n%2 == 0 {
return 2
}
for i := int64(3); i*i <= n; i += 2 {
if n%i == 0 {
return i
}
}
return n
}
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
var t int
fmt.Fscan(in, &t)
for ; t > 0; t-- {
var n int64
fmt.Fscan(in, &n)
p := smallestPrimeFactor(n)
a := n / p
b := n - a
fmt.Fprintln(out, a, b)
}
}