1 条题解

  • 0
    @ 2019-01-22 20:00:34

    //贪心
    #include <iostream>
    using namespace std;

    int main()
    {
    int n, i, j, sum = 0;
    int power[100010] = {0};
    bool IsBeated[100010];
    cin >> n;
    for (i = 0; i < n; ++i)
    cin >> power[i];
    for (i = 0; i < n; ++i)
    IsBeated[i] = false;
    for (i = 0; i < n; ++i)
    {
    int max = 0;
    for (j = i; j < n; ++j)
    if (!IsBeated[j] && max < power[j])
    {
    if (max == 0) ++sum;
    max = power[j];
    IsBeated[j] = true;
    }
    }
    cout << sum << endl;
    return 0;
    }

  • 1

信息

难度
6
分类
(无)
标签
(无)
递交数
112
已通过
28
通过率
25%
被复制
4
上传者