sicily--1157. The hardest problem


#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int test;
    cin >> test;
    while(test != 0)
    {
        vector<int> v(0);
        int i;
        for(int a = 0; a < test; ++a)
        {
            cin >> i;
            v.push_back (i);
        }
        vector<int>::iterator it;
        it = v.begin ();
        int max = *it;
        for(;it != v.end ();++it)
        {
            if(*it > max)
                max = *it;
        }
        cout << max << endl;
        cin >> test;
    }
    return 0;
}                                 


你可能感兴趣的:(iterator)