Difference between r1.4 and the current
@@ -5,7 +5,7 @@
== Source Code ==
{{{
import java.util.Scanner;
{
Scanner scan = new Scanner(System.in);
{{{
import java.util.Scanner;
public class JollyJumpers{
public class Main{
public static void main(String [] args){
Scanner scan = new Scanner(System.in);
Status ¶
Problem | 2575 | User | talin0528 |
Memory | 5224K | Time | 360MS |
Language | Java | Result | Accepted |
Source Code ¶
import java.util.Scanner; public class Main{ public static void main(String [] args) { Scanner scan = new Scanner(System.in); int[] arr = new int[3000]; while(scan.hasNextInt()){ int size = scan.nextInt(); int i; for(i=0; i<size; i++){ arr[i] = scan.nextInt(); } if(isJolly(arr, size)){ //졸리점퍼 체크 System.out.println("Jolly"); }else{ System.out.println("Not jolly"); } } } public static boolean isJolly(int [] arr, int size){ int [] jollyNum = new int [size]; for(int i=0; i<size-1; i++){ if(Math.abs(arr[i+1]-arr[i]) >= size)//size 넘어가면 1~n-1을 넘어가니까. return false; else jollyNum[Math.abs(arr[i+1]-arr[i])]++; } for(int i=1; i<=size-1;i++){ if(jollyNum[i] == 0)//1~n-1 중 하나라도 포함 안하면 not jolly return false; } return true; } }