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

这样为什么不对啊!!!!!!!!!哪位能帮看一下啊????????

Posted by 22220000 at 2009-02-22 15:33:58 on Problem 3096
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int num[100000];
int main()
{
   int i,j,k,l,m,n;
   char a[85];
   while(scanf("%s",a)!=EOF&&strcmp(a,"*"))
   {     
      l=strlen(a);  
      int g=0;
      for(i=1;i<l;i++)
      {
         memset(num,0,sizeof(num));
         k=i;j=0;m=-1000;n=-1000;
         while(k<l)
         {
            m=a[k]-a[j];
            num[j]=m;
            k++;j++;            
            if(m==n&&m!=-1000)
            {
                     printf("%s is NOT surprising.\n",a);
                     //return 1;
                     g=1;
                     break;
            }
            if(m!=n)  n=m;   
         }        
         if(g) break;
         else
         {
           sort(num,num+j); 
           for(int ii=0;ii<j-1;ii++)
           {
               if(num[ii]==num[ii+1])
               {
                     g=1;
                     printf("%s is NOT surprising.\n",a);
                     break;   
               }   
            }
         }
         if(g) break; 
      }
       if(!g)       
       printf("%s is surprising.\n",a);
   }
}

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