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

想法是对的啊。。why wa 呢?

Posted by bean244 at 2009-08-05 20:01:18 on Problem 3096
#include<stdio.h>
#include<string.h>
int mark[30][30];
int  a[90],len;
bool issurp()
{
    memset(mark,0,sizeof(mark));
    for(int k=1;k<len;k++)//间距
    {
        for(int i=0;i+k<len;i++)
            if(mark[a[i]][a[i+k]]==k) return false;
            else mark[a[i]][a[i+k]] = k;
    }
    return true; 
}
int main()
{
    char s[90];
    while(gets(s)){
        len=strlen(s);
        if(len==1&&s[0]=='*') break;
        for(int i=0;i<len;i++)  a[i]=s[i]-'A';
        printf("%s is ",s);
        if(!issurp()) printf("not ");
        puts("surprising.");
    }
}

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