Co-authored-by: Evan Burkey <dev@fputs.com>
Reviewed-on: https://git.fputs.com/fputs/protohackers/pulls/3
This commit is contained in:
Evan Burkey
2022-11-08 00:02:36 +01:00
parent bc17b6befc
commit 3bd3a895b5
3 changed files with 78 additions and 8 deletions

View File

@ -1,7 +1,6 @@
package main
import (
"bufio"
"encoding/json"
"log"
"math/big"
@ -29,13 +28,7 @@ func main() {
}
func primetime(c net.Conn) {
defer c.Close()
sc := bufio.NewScanner(c)
for sc.Scan() {
response := process(sc.Bytes())
c.Write(response)
}
if err := sc.Err(); err != nil {
if err := conn.ReadAndRespond(c, process); err != nil {
log.Fatalln(err)
}
}