1. 徒步

    f9c031675bc0a58f76506958bf9846d6_.jpg
    df5f6df83101780f803ba429f54c98f8_.jpg

    1. public static void main(String[]args){
    2. Scanner in=new Scanner(System.in);
    3. int days=in.nextInt();
    4. int nums=in.nextInt();
    5. int [][]food=new int[nums][2];
    6. in.nextLine();
    7. for(int i=0;i<nums;i++){
    8. food[i][0]=in.nextInt();
    9. food[i][1]=in.nextInt();
    10. }
    11. int res = 0;
    12. int min = Integer.MAX_VALUE;
    13. int cur = days;
    14. while (nums > 0) {
    15. if (food[nums - 1][1] < min && nums >= 1) min = food[nums - 1][1];
    16. else {
    17. res += (cur - food[nums][0]) * min;
    18. min = Integer.MAX_VALUE;
    19. cur = food[nums][0];
    20. }
    21. if (nums == 1) {
    22. res += (cur - food[0][0]) * food[0][1];
    23. }
    24. nums--;
    25. }
    26. System.out.println(res);
    27. }
    1. 如何公平分土地

    7a97221648a3a75cdaf2acf501d6041f_.jpg
    8aba0c2227accaa5fe39958e0123bf86_.jpg

    1. 字符串大小写变换

    50f5447a38ab442ed148b760531ae180_.jpg
    96c77076a0de6a81c958e6a8eded57f5_.jpg