注意最后一页可能不够m个就行了:
import java.util.*; public class Main { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] v = new int[n]; for(int i = 0; i < n; ++i) v[i] = sc.nextInt(); int r = sc.nextInt(), m = sc.nextInt(); if(r*m >= n){ System.out.println("超过分页范围"); return; } for(int i = r*m; i < Math.min(n, r*m + m); ++i){ //最后一页可能不够m个 System.out.println(v[i]); } } }