# Jolly Jumpers/김태진

## Difference between r1.2 and the current

@@ -1,6 +1,6 @@
== Status ==
||Memory||184K||Time||110MS||
||||||||구현: 2시간, 입출력 및 디버깅:3시간||
||||||||구현: 1시간, 입출력 및 디버깅:4시간||
== Source Code ==
{{{
#include <stdio.h>

## Status ¶

 Memory 184K Time 110MS 구현: 1시간, 입출력 및 디버깅:4시간

## Source Code ¶

```#include <stdio.h>

int jolly(int A[], int val, int B[]);
int bubbleSort(int A[], int n);

int main()
{
int a[3001]={0};
int b[3001]={0};
int i,val,result;

while(1){
scanf("%d",&val);
if(feof(stdin)) break;
for(i=0;i<val;i++){
scanf("%d",&a[i]);
}
if(val==1) {
printf("Jolly\n");
if(feof(stdin)) break;
continue;
}
result=jolly(a,val,b);
if(result==val-2) printf("Jolly\n");
else printf("Not jolly\n");
if(feof(stdin)) break;
}
return 0;
}

int jolly(int A[], int val, int B[])
{
int x=0,j;
for(j=0;j<val-1;j++){
B[j]=((A[j]-A[j+1])>0?(A[j]-A[j+1]):-(A[j]-A[j+1]));
}
//두개의 값사이의 차를 B함수에 넣음.

bubbleSort(B, val);
if(B[0]!=1) return -100;
for(j=0;j<val-2;j++){
if(B[j+1]-B[j]==1) x+=1;
}

return x;
}

int bubbleSort(int C[], int n)
{
int i,j,temp;
for(i=n-2;i>=1;i--){
for(j=0;j<i;j++){
if(C[j]>C[j+1]){
temp=C[j];
C[j]=C[j+1];
C[j+1]=temp;
}
}
}

return 0;
}

```