Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么会RE。。。

Posted by HuaJW at 2011-02-04 17:17:23 on Problem 3193 and last updated at 2011-02-04 17:18:00
暴搜。。。TLE我就认了,RE很奇怪啊

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

bool mysubstr(char *s,char *s0)
{
    int i=0,len=strlen(s);
    if(len>60)return 0;
    for(i=0;i<len;i++)
    {
        if(s[i]!=s0[i])return 0;        
    }     
    return 1;
}

int main()
{
    int m,n,i,j,cnt=0;
    char dict[1000][100],s[10000];
    scanf("%d%d",&m,&n);
    getchar();
    for(i=0;i<m;i++)gets(dict[i]);
    for(i=0;i<n;i++)
    {
        memset(s,0,sizeof(s));
        gets(s);
        j=0;
        while(mysubstr(s,dict[j])==0)j++;
        if(j<m)cnt++;                
    }
    printf("%d\n",cnt);
    //system("pause");
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator