[ # 6ํ์ฐจ ์ ๋ณด ]
- 2024๋ 7์ 30์ผ 19:00 - 22:00
- Discord ์์ ํตํ๋ก ์จ๋ผ์ธ ์คํฐ๋ ํ์ ์งํ
[ # 6ํ์ฐจ ๊ฐ์ธ ๋ชฉํ ]
Java ๋ฐฑ์ค ๋ฌธ์ ํ์ด ์งํ
- ์ค๋ฒ 4 13411๋ฒ
- ์ค๋ฒ 4 1620๋ฒ
[ # 6ํ์ฐจ ๊ฐ์ธ ํ๋ ๋ด์ฉ ]
13411๋ฒ: ํ๋์์ ์ ์๊ฐ ๋น๋ฐ์น๋ค!
https://www.acmicpc.net/problem/13411
import java.util.*;
import java.io.*;
public class Main {
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw= new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] args) throws NumberFormatException, IOException {
int N=Integer.parseInt(br.readLine());
double []A=new double[N];
Map<Integer,Double> Speed_list=new HashMap<>();
double a=0;
for(int i=0; i<N; i++) {
st=new StringTokenizer(br.readLine());
int x=Integer.parseInt(st.nextToken());
int y=Integer.parseInt(st.nextToken());
int speed=Integer.parseInt(st.nextToken());
Speed_list.put(i+1,Math.sqrt(x*x+y*y)/speed);
}
List<Integer> list = new ArrayList<>(Speed_list.keySet());
Collections.sort(list, (o1, o2) -> Double.compare( Speed_list.get(o1), Speed_list.get(o2) ) );
//ํด์ฌ๋งต์ value๋ฅผ ๊ธฐ์ค์ผ๋ก key๋ฅผ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํ๋ ์ฝ๋
//list์์ key๊ฐ์ ๊ฐ์ ธ์์ Speed_list์์
//๊ทธ key๊ฐ์ ํด๋นํ๋ value๋ค์ ์๋ก ๋น๊ตํ ๋ค์ list๋ฅผ ์ ๋ ฌ
for(int i=0; i<N; i++) {
bw.write(list.get(i)+"\n");
}
bw.flush();
bw.close();
}
}
1620๋ฒ: ๋๋์ผ ํฌ์ผ๋ชฌ ๋ง์คํฐ ์ด๋ค์
https://www.acmicpc.net/problem/1620
import java.util.*;
import java.io.*;
public class Main {
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw= new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] args) throws NumberFormatException, IOException {
String SSS=br.readLine();
st=new StringTokenizer(SSS);
int N=Integer.parseInt(st.nextToken());
int M=Integer.parseInt(st.nextToken());
Map<Integer,String> Name=new HashMap<>();
Map<String,Integer> RRRName=new HashMap<>();
for(int i=0; i<N; i++) {
Name.put(i+1,br.readLine());
}
for (Map.Entry<Integer, String> entry : Name.entrySet()) {
RRRName.put(entry.getValue(), entry.getKey());
}
//value๋ key๊ฐ ์์น๋ฅผ ๋ฐ๊พผ RRRName ๋งต ์์ฑ
for(int i=0; i<M; i++) {
String QQQ=br.readLine();
if('0'<=QQQ.charAt(0) && QQQ.charAt(0)<= '9' ) {
bw.write(Name.get(Integer.parseInt(QQQ))+"\n");
}
else {
bw.write(RRRName.get(QQQ)+"\n");
}
}
bw.flush();
bw.close();
}
}
'๐ ๊ฐ์ธ ํ๋ ๋ชจ์์ง ๐ > ๐ฉ๐ปโ๐ป `24 ํ๊ณ ๋ชจ๊ฐ์ฝ ๐ฉ๐ปโ๐ป' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 5ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.28 |
---|---|
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 4ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 3ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 2ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.14 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 1ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.14 |