Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的代码写得很垃圾,你自己测数据吧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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator