SDUT 2075 最少拦截系统

来源:互联网 发布:windows 守护进程 编辑:程序博客网 时间:2024/05/17 10:04

最少拦截系统 

点击打开链接

#include <iostream>#include <cstdio>#include <cstring>using namespace std;int pp[310];int main(){    int n, num;    while(cin >> n)    {        num = 0;        for(int i = 0; i < n; i++)            cin >> pp[i];        for(int i = 0; i < n; i++)        {            if(pp[i] != 0)            {                int h = pp[i];                for(int j = i+1; j < n; j++)                {                    if(pp[j] <= h && pp[j] != 0)                    {                        h = pp[j];                        pp[j] = 0;                    }                }                 num++;            }        }        cout << num << endl;    }    return 0;}


0 0
原创粉丝点击