Skip to content

Commit

Permalink
daily
Browse files Browse the repository at this point in the history
  • Loading branch information
runnz121 committed Jul 30, 2023
1 parent 23aeb8d commit 9f6d6c7
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 8 deletions.
Binary file added out/production/classes/algorithm/_19523.class
Binary file not shown.
Binary file modified out/production/classes/algorithm/_25206.class
Binary file not shown.
Binary file added out/production/classes/algorithm/_27323.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions src/main/java/algorithm/_19523.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package algorithm;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class _19523 {

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());


}

}
32 changes: 24 additions & 8 deletions src/main/java/algorithm/_25206.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

public class _25206 {

static List<String> lists = new ArrayList<>();
// 2차원 리스트로 설정
static List<List<String>> lists = new ArrayList<>();

// 최대 10개까지는 of로 설정 가능
static Map<String, Double> grade = Map.of(
"A+",4.5,
"A0",4.0,
Expand All @@ -28,20 +31,33 @@ public class _25206 {
public static void main(String[] args) throws IOException {
// 입력값이 존재할 떄까지 받기
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
int count = 0;
while (count != 20) {
StringTokenizer st = new StringTokenizer(br.readLine());
if (!st.hasMoreElements()) {
break;
}
// index 1씩 증가시켜 list로 저장
String[] stToken = new String[3];
int idx = 0;
while (st.hasMoreTokens()) {
stToken[idx] = st.nextToken();
idx ++;
}
lists.add(Arrays.toString(stToken));
List stringList = new ArrayList(Arrays.asList(stToken));
lists.add(stringList);
count += 1;
}
//

Double answer = 0.000000;
Double totalGrade = 0.0;
for (List<String> arr : lists) {
String key = arr.get(2);
Double gr = Double.valueOf(arr.get(1));
if (key.equals("P")) {
continue;
}
Double val = 0.000000;
val = grade.get(key);
answer += val * gr;
totalGrade += gr;
}
System.out.printf("%.6f", answer/totalGrade);
}
}
17 changes: 17 additions & 0 deletions src/main/java/algorithm/_27323.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package algorithm;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class _27323 {

public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());

System.out.println(a * b);
}
}
17 changes: 17 additions & 0 deletions src/main/java/algorithm/programmers/Integer_in_two_circles.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package algorithm.programmers;

public class Integer_in_two_circles {

public long solution(int r1, int r2) {


return answer;
}

public static void main(String[] args) {
Integer_in_two_circles ts = new Integer_in_two_circles();
int r1 = 2;
int r2 = 4;
ts.solution(r1, r2);
}
}
28 changes: 28 additions & 0 deletions src/main/java/algorithm/programmers/Target_System.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package algorithm.programmers;

import java.util.Arrays;

public class Target_System {

public int solution(int[][] targets) {
int answer = 0;
int end = 0;
// 2번째 원소 오름차순
Arrays.sort(targets, (o1, o2) -> o1[1] - o2[1]);
for (int [] target : targets) {
int s = target[0];
int e = target[1];
// 첫번째가 end 보다 작다면 넘어감 (범위 안에 존재한다는 뜻)
if (s < end) continue;
// 그렇지 않다면 범위를 벗어난다는 의미임으로 갱신 및 미사일 갯수 증가
else end = e; answer += 1;
}
return answer;
}

public static void main(String[] args) {
Target_System ts = new Target_System();
int[][] targets = {{4,5},{4,8},{10,14},{11,13},{5,12},{3,7},{1,4}};
ts.solution(targets);
}
}

0 comments on commit 9f6d6c7

Please sign in to comment.