Created
April 26, 2016 07:56
-
-
Save PreSoichiSumi/5095934c43fb9d4904e46a4471b3ef70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
int L=sc.nextInt(); | |
int H=sc.nextInt(); | |
int N=sc.nextInt(); | |
List<Integer> list=new ArrayList<Integer>(); | |
for(int i=0;i<N;i++){ | |
list.add(sc.nextInt()); | |
} | |
for(Integer i:list){ | |
if(L<=i && i<= H){ | |
System.out.println(0); | |
}else if(i<L){ | |
System.out.println(Math.abs(L-i)); | |
}else{ | |
System.out.println(-1); | |
} | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment