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 1496. Spammer

Wat is wrong in my program
Posted by mihran 22 Oct 2007 22:27
# include <string.h>
# include <iostream.h>
int main()
{
    char a[100][30];
    int N,i,j,k,h;
    cin>>N;
    if (0<=N && 100>=N)
    {
        for (i=0;i<N;i++)
            cin >>a[i];
        for (i=0;i<N;i++)
        {
            k=0;
            for (j=0;j<N;j++)
            {
                if (strcmp(a[i],a[j])==0)
                    k++;
            }
            if (k>=2)
            {
                h=0;
                for(j=0;j<i;j++)
                {
                    if(strcmp(a[i],a[j])!=0)
                        h++;
                }
                if (h==i)
                    cout<< a[i]<<endl;
            }
        }
    }
    return 0;
}
Re: Wat is wrong in my program
Posted by yaho0o0 6 Apr 2009 21:35
char a[100][30]; - here is your mistake i change it to
char a[128][32]; and I got AC
Re: Wat is wrong in my program
Posted by aditya 3 Jun 2009 01:31
Thanks Boss,
I changed from  char a[100][30]

              to char a[128][32]

and now i got accepted.

Can u explain the reason for it.
Re: Wat is wrong in my program
Posted by Geeks_Club 17 Apr 2010 21:41
in the end of string is two system

Edited by author 17.04.2010 21:41

Edited by author 17.04.2010 21:41