欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

Hengsheng2025春校招編程題

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); // 點的數(shù)量
        int[][] points = new int[n][2]; // 點的坐標(biāo)數(shù)組
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            points[i][0] = x; // 橫坐標(biāo)初始化
            points[i][1] = y; // 縱坐標(biāo)初始化
        }
        int[] k = new int[n-1]; // 斜率數(shù)組,兩點一線,所以容量減一
        for (int i = 0; i < n - 1; i++) { // 縱坐標(biāo)之差與橫坐標(biāo)之差的比
            k[i] = (points[i+1][1] - points[i][1]) / (points[i+1][0] - points[i][0]);
        }
        int max = 0;
        int now = 1;
        for (int i = 0; i < n - 1 - 1; i++) {
            if (k[i] < k[i+1]) { // 如果斜率遞增
                now++;
            } else {
                max = Math.max(max, now);
                now = 1;
            }
        }
        max = Math.max(max, now);
        if (max == 1)
            System.out.println(-1);
        else
            System.out.println(max);
    }
}
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); // 小電池的總數(shù)量
        int q = in.nextInt(); // 詢問次數(shù)
        int c = in.nextInt(); // 電量閾值
        int[] x = new int[n]; // 橫坐標(biāo)數(shù)組
        int[] y = new int[n]; // 縱坐標(biāo)數(shù)組
        int[] s = new int[n]; // 電量數(shù)組
        for (int i = 0; i < n; i++) { // 為每個小電池初始化坐標(biāo)和電量
            x[i] = in.nextInt();
            y[i] = in.nextInt();
            s[i] = in.nextInt();
        }
        for (int _q = 0; _q < q; _q++) { // 每次詢問
            int t = in.nextInt(); // 要計算的時刻
            int[] _s = new int[n]; // 臨時電量數(shù)組
            for (int _t = 0; _t <= t; _t++) { // 從開始到t時刻
                for (int i = 0; i < n; i++) { // 更新每個小電池
                    if (_t == 0) { // 如果是零時刻
                        _s[i] = s[i]; // 復(fù)制初始電量
                    } else { // 計算當(dāng)前時刻電量
                        if (s[i] + 1 <= c) {
                            _s[i]++;
                        } else {
                            _s[i] = 0;
                        }
                    }
                }
            }
            int sum = 0; // 電量之和
            int x1 = in.nextInt();
            int x2 = in.nextInt();
            int y1 = in.nextInt();
            int y2 = in.nextInt();
            for (int i = 0; i < n; i++) { // 遍歷每個小電池
                if (x1 <= x[i] && x[i] <= x2) { // 橫坐標(biāo)在區(qū)間內(nèi)
                    if (y1 <= y[i] && y[i] <= y2) { // 縱坐標(biāo)在區(qū)間內(nèi)
                        sum += _s[i];
                    }
                }
            }
            System.out.println(sum);
        }
    }
}

全部評論

相關(guān)推薦

點贊 評論 收藏
分享
評論
點贊
收藏
分享

創(chuàng)作者周榜

更多
牛客網(wǎng)
??推髽I(yè)服務(wù)