2020/4/11---ACM初赛---牛客网---

在这里插入图片描述
输入

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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值