抓捕孔连顺

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int n = Integer.parseInt(str.split(" ")[0]);
        int d = Integer.parseInt(str.split(" ")[1]);
        if(n<1 || d<1) return;
        String[] input = sc.nextLine().split(" ");
        if(input.length<3) return ;
        long cnt=0;
        int j=1;
        for(int i=0;id){
                    cnt+=cn2(j-i-1);
                    break;
                }
                else{
                    if(j==input.length-1){
                        cnt+=cn2(j-i);
                        break;
                    }
                }
            }
        }
        System.out.println(cnt%99997867);
    }
    public static long cn2(int n){
        return (long)n*(n-1)/2;
    }
}

你可能感兴趣的:(抓捕孔连顺)