diff options
-rw-r--r-- | sd.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -16,7 +16,7 @@ var file = flag.String("f", "cards", "cards file") var sum = 0 var seg = []int{} -func build(a *sql.Rows, l int, r int, n int) { +func build(a *sql.Rows, l, r, n int) { if l == r { a.Next() a.Scan(&seg[n]) @@ -29,7 +29,7 @@ func build(a *sql.Rows, l int, r int, n int) { seg[n] = seg[n<<1] + seg[n<<1|1] } -func update(x int, v int, l int, r int, n int) { +func update(x, v, l, r, n int) { if l == r { seg[n] = v return @@ -43,7 +43,7 @@ func update(x int, v int, l int, r int, n int) { seg[n] = seg[n<<1] + seg[n<<1|1] } -func query(v int, l int, r int, n int) (int, int) { +func query(v, l, r, n int) (int, int) { if l == r { return seg[n], l } @@ -92,7 +92,7 @@ func main() { w, i := query(x, 0, N-1, 1) fmt.Println(w) fmt.Println(i) - + // Get card contents from database var key, val string db.QueryRow("SELECT key, val FROM cards WHERE idx=?", i).Scan(&key, &val) |