diff --git "a/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_2246.java" "b/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_2246.java" new file mode 100644 index 0000000..792f98c --- /dev/null +++ "b/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_2246.java" @@ -0,0 +1,100 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.Comparator; +import java.util.StringTokenizer; + +public class Main { + + public static void main(String[] args) throws IOException{ + // TODO Auto-generated method stub + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int n = Integer.parseInt(br.readLine()); + + Condo[] condoes = new Condo[n]; + + for(int i=0; i cpd = new Comparator() { + @Override + public int compare (Condo c1, Condo c2) { + if(c1.getD() > c2.getD()) return 1; + else if (c1.getD() == c2.getD()) { + if(c1.getC() < c2.getC()) return 1; + else return -1; + } + else return -1; + } + }; + + //가격 순으로 오름차순 정렬하는 Comparator + Comparator cpc = new Comparator() { + @Override + public int compare(Condo c1, Condo c2) { + if(c1.getC() > c2.getC()) return 1; + else if(c1.getC() == c2.getC()) { + if(c1.getD() < c2.getD()) return 1; + else return -1; + } + else return -1; + } + }; + + //거리 순으로 오름차순 정렬 + Arrays.sort(condoes, cpd); + + //모든 콘도에 대하여, 나보다 바닷가에 가까운 콘도 중 가격이 더 싸거나 같은 것이 있는지 판단 + for(int i=0; i=condoes[j].getC()) { + condoes[i].setCheck(false); + break; + } + } + } + + + //가격 순으로 오름차순 정렬 + Arrays.sort(condoes, cpc); + + //모든 콘도에 대하여, 나보다 싼 콘도 중 거리가 바닷가에 가깝거나 같은 것이 있는지 판단 + for(int i=0; i= condoes[j].getD()) { + condoes[i].setCheck(false); + break; + } + } + } + + + int answer = 0; + for(Condo c: condoes) { + if(c.getCheck()) answer++; + } + + System.out.print(answer); + } + +} + +class Condo { + private int d; //거리 + private int c; //가격 + private boolean check; //false가 되면 후보 탈락 + public Condo(int d, int c) { + this.d = d; + this.c = c; + this.check = true; + } + public int getD() {return d;} + public int getC() {return c;} + public void setCheck(boolean check) {this.check = check;} + public boolean getCheck() {return check;} +} diff --git "a/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_4436.java" "b/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_4436.java" new file mode 100644 index 0000000..5bfed18 --- /dev/null +++ "b/11\354\233\22416\354\235\274/\354\264\210\354\244\221\352\270\211/1923012_4436.java" @@ -0,0 +1,36 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashSet; + +public class Main { + + public static void main(String[] args) throws IOException{ + // TODO Auto-generated method stub + + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + String input = null; + + while((input=br.readLine()) != (null)) { + long n = Long.parseLong(input); + + //0부터 9까지의 숫자가 담겨있는 해시셋 선언 + HashSet hs = new HashSet(); + for(int i=0; i<10; i++) hs.add((char)(i+'0')); + + //초기값이 0인 k 선언 + long k = 0; + while(true) { + k++; //k를 1 증가시킴 + String str = Long.toString(k*n); //곱셈 + for(int i=0; i