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 Rainco at 2008-01-15 19:18:48 on Problem 2575
In Reply To:实在看不出怎么WA Posted by:emperorlu at 2008-01-15 15:26:04
#include <string>
#include <cmath>
using namespace std;
int se[3001] ;
int num[3001] ;
void MakeSe( int n )
{    int i ;
     memset(se , 0 , sizeof(se)) ;
     for ( i = 0 ; i < n - 1 ; i++ )
        {   se[(int)fabs(double(num[i] - num[i+1]))] = 1 ;
        }
}
bool Judge(int  n)
{    int i ;
     for ( i = 1 ; i < n && se[i] == 1 ; i++ ) ;
     if ( i == n )
       return true ;
     else
       return false ;
        
     
     
}
int main()
{   int n;
    while ( scanf("%d" , &n) != EOF )
         {   int i ;
             for ( i = 0 ; i < n ; i++ )
                scanf("%d" , &num[i]) ;
             MakeSe(n) ;
             if (Judge(n))
               printf("Jolly\n") ;
             else
               printf("Not jolly\n") ;          
         }
    
}

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