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

不解释,直接代码!我就因为包错了不是<cmath>而是<cstdlib>错了n次

Posted by guangmingge at 2013-03-24 09:55:48 on Problem 2575
#include<iostream>
#include<stdlib.h>
#include<cstring>
#include<cstdlib>
using namespace std;

int main(){
    int num;

    while(cin>>num){
        int i;
        int *Jump = (int*)malloc(sizeof(int)*num);
        bool *flag = (bool*)malloc(sizeof(bool)*num);
        memset(flag,false,sizeof(bool)*num);

        for(int j=0;j<num;j++){
            cin>>Jump[j];
        }

        for(i=1;i<num;i++){
            int tmp;
            tmp = abs(Jump[i]-Jump[i-1]);
            if(flag[tmp]){
                break;
            }
            flag[tmp] = true;
        }

        if(i==num){
            cout<<"Jolly"<<endl;
        }else{
            cout<<"Not jolly"<<endl;
        }
    }
    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