|
|
back to boardWHAT IS WRONG?????? #include <iostream> #include <string> #include <algorithm> using namespace std; const int N=100; int main() { int n,i,k; int x[N],y[N]; string z[N]; int total_s=0,total_h=0; cin>>n; cin>>ws; for(i=0;i<n;i++) { getline(cin,z[i]); } for(i=0;i<n;i++) { if(z[i][2]=='s') { y[total_s++]=z[i][0]-48; } if(z[i][2]=='h') { x[total_h++]=z[i][0]-48; } } sort(x,x+total_h); sort(y,y+total_s); if(total_s==0) { cout<<"10"<<endl; } else { if(y[0]<=x[total_h-1]) { cout<<"Inconsistent"<<endl; } else { cout<<y[0]<<endl; } } return 0; } |
|
|