| 
 | 
вернуться в форумI give up  ,WA#12 #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; int main() {     int n;     cin >> n;     vector<int> ivec;     vector<string> svec;     int val;     string s;     for (int i = 0; i < n; ++i)     {         cin >> val;         ivec.push_back(val);         cin >> s;         svec.push_back(s);     }     if (n == 0)     {    cout << 10 <<endl;    return 0;}     if (n == 1)     {         if (svec[0] == "satisfied")         {    cout << ivec[0] << endl;    return 0;}         if (svec[0] == "hungry")         {    cout << 10 << endl;    return 0;}     }     int hungry[100]={0},satisfied[100]={0};     int hungry_num=0,satisfied_num=0;     for (int i = 0; i < n; ++i)     {         if (svec[i] == "hungry")         {             hungry[hungry_num++] = ivec[i];         }         if (svec[i] == "satisfied")         {             satisfied[satisfied_num++] = ivec[i];         }     }     sort(hungry, hungry+hungry_num);     sort(satisfied, satisfied+satisfied_num);     if (hungry[hungry_num-1] >= satisfied[0])     {             cout << "Inconsistent" << endl;             return 0;     }     cout << satisfied[0] << endl;     return 0; } Re: I give up  ,WA#12 When n == 0; What is the answer? Re: I give up  ,WA#12 Послано  O.K. 24 сен 2012 21:58 if n==0 answer is 10   Edited by author 24.09.2012 21:58  |  
  | 
|