|
|
вернуться в форумWA#2 can anyone help me? here is my code: #include<iostream> using namespace std; #include<string> #include<cctype> int main() { string str[201],universityname[201]; int n,m,i,j,k=1; cin>>n>>n>>m; getchar(); i=0; while(i<n) { getline(cin,str[i]); i++; } for(i=0;i<n;i++) { for(j=0;j<str[i].length();j++) if(str[i][j]==' '&&str[i][j+1]=='#') break; for(k=j-1;k>=0;k--) if(str[i][k]==' ') break; universityname[i].assign(str[i],0,k); } for(i=0;i<n;i++) for(j=0;j<universityname[i].length();j++) universityname[i][j]=tolower(universityname[i][j]); k=1; for(i=0;i<n;i++) { for(j=0;j<i;j++) if(universityname[i]==universityname[j]) break; else if(j==i-1) k++; if(k>=m) break; } cout<<str[i]<<endl; return 0; } Edited by author 26.08.2009 08:27 |
|
|