U E D R , A S I H C RSS

Jolly Jumpers/이승한

Jolly Jumpers/

...ㅠ.ㅠㅋ
.
abs ;;
히 해 ;;
~cpp 
#include <iostream>
#include <cctype>
using namespace std;

const int MAX = 3000;
const int MAXLine = 10;

int checkJolly(int * array, int differ, bool programEnd = 0);

void main(){
	
	int array[MAX] = {0};
	int differ; // 10  9 .
	char endCheck;

	differ = endCheck = 0;
	
	while(1){
		if( !(cin>>array[differ]) )break;
		
		differ++;

		cin.get( endCheck );

		if( endCheck == '\n' ){
			checkJolly( array, differ );
			differ = 0;
		}
	}
	checkJolly( array, differ, 1 );
}

int checkJolly(int * array, int differ, bool programEnd){ //differ n-1  .
	static bool boolJolly[10]={1,1,1,1,1,1,1,1,1,1}; //      jolly .
	static int line = 0;

	// .
	if( programEnd ){
		for(int i = 0; i < line; i++ ){
			if( boolJolly[i] )cout<<"Jolly\n";
			else cout<<"Not jolly\n";
		}
		return 0;
	}

	//jolly jumper 판
	for(int i = 1; i < differ - 1; i++){
		if( ( differ < ( array[i] - array[i-1])) || (differ < ( array[i-1] - array[i])) || (differ < ( array[i] - array[i+1]) ) || (differ < ( array[i+1] - array[i]) ) ) { //
			boolJolly[ line ] = 0; // NOTjolly  boolJolly 
		}
	}
	
	line++;
	return 0;
}


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:34
Processing time 0.0079 sec