淘先锋技术网

首页 1 2 3 4 5 6 7
package main

import (
	"flag"
	"fmt"
)

const (
	szie int = 5
)

var p *int = flag.Int("p", 0, "ente page")
var s *int = flag.Int("s", 10, "ente szie")

func main() {
	flag.Parse()

	data := make([]int, *s)
	for i := 1; i < *s; i++ {
		data[i] = i
	}
	newd := make([]int, szie)
	if *p <= 0 {
		newd = data[:szie]
	} else {
		m := *p * szie

		if m <= *s {
			j := m - szie
			newd = data[j:m]
		}
	}
	fmt.Printf("%v", newd)
}