输入
2 10
8 5
输出
3
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int[] h = new int[a];
long s = 1L;//加L
if ((a >= 2 && a <= 2 * 1e5) && (b >= 1 && b <= 1000)){
for (int i = 0; i < a; i++) {
h[i] = sc.nextInt();
}
for (int i = 0; i <a; i++) {
for(int j=i+1;j<a;j++){
s = s*Math.abs(h[i] - h[j])%b;//取模
}
}
}
System.out.println(s);
}
}
Giant pandas like to eat bamboo most. Now there are M bamboo in the zoo. Their lengths are S1, S2 SN. There are N pandas in the zoo. As an employee, you need to cut the bamboo and distribute it evenly on each panda.A panda can only get a section of bamboo. You need to cut the bamboo into N segments of the same length. What is the maximum length of each section of bamboo? (Keep the answer to two decimal places)
Limit:
1≤M≤10000
1≤N≤10000
1≤Si≤100000
输入描述:
Number of Bamboo
Number of pandas
Length of each section of bamboo
输出描述:
the maximum length of each section ofbamboo(Keep two decimal places)
示例1:
4
11
8.02 7.43 4.57 5.39