ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1680. The First Nonqualifying

WA#2 can anyone help me?
Posted by Time-warren258 26 Aug 2009 08:27
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