2 条题解

  • 0
    @ 2025-10-24 18:23:08

    按题意,即求出所有高度的最大值,可以直接使用 max⁡\max 函数。

    AC code:

    #include <bits/stdc++.h>
    using namespace std;
    int main() {
        int x;
        cin >> x;
        int max_height = 0;
        for (int i = 1; i <= x; i++) {
            int a;
            cin >> a;
            max_height = max(max_height, a);
        }
        cout << max_height << endl;
        return 0;
    }
    
    • 0
      @ 2025-9-6 15:03:20

      根据题意可得是序列中的最大值。

      #include<bits/stdc++.h>
      using namespace std;
      int a[100010],n;
      int main()
      {
          cin>>n;
          for(int i=1;i<=n;i++)cin>>a[i];
          cout<<*max_element(a+1,a+1+n);
          return 0;
      }
      
      • 1

      信息

      ID
      57
      时间
      1000ms
      内存
      256MiB
      难度
      1
      标签
      递交数
      9
      已通过
      5
      上传者