1. 最长连续子序列和

    vector<int> a;
    int t ,res = INT_MIN,sum= 0;
    while(cin>>t){
     sum += t;
     res = max(res,sum);
     if(sum<0) sum = 0;
    }
    cout<<res<<endl;
    
  2. 数组中第k大数

    vector<int> a;
    int t;
    while(cin>>t) a.push_back(t);
    int k = a.back();
    a.pop_back();
    priority_queue<int> pq(less<int>(),a);
    k--;
    while(k--) pq.pop();
    cout<<pq.top()<<endl;