U E D R , A S I H C RSS

JollyJumpers/서지혜 (rev. 1.1)

Jolly Jumpers/서지혜

#include <stdio.h>
#include <math.h>

int main(){
	int count;
	int a[3000];
	bool isJ[3000] = {false};
	bool jollyFlag=false;
	while(true) {
		if(feof(stdin))	break;
		scanf("%d", &count);
		for(int i=0; i<count; i++){
			scanf("%d", &a[i]);
		}

		for(int i=1; i<count; i++){
			int index = abs(a[i]-a[i-1]);
			if(isJ[index]) {
				printf("Not jolly\n");
				jollyFlag=true;
				break;
			}
			isJ[index] = true;
		}
		if(jollyFlag==false) {
			printf("Jolly\n");
		}

		jollyFlag = false;
		for(int i=0; i<=count; i++){
			isJ[i]=false;
		}
	}
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:34
Processing time 0.0133 sec