일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 검색엔진
- 자연어처리 논문 리뷰
- Leveraging Slot Descriptions for Zero-Shot Cross-Domain Dialogue State Tracking
- From Machine Reading Comprehension to Dialogue State Tracking: Bridging the Gap
- MySQL
- 백준
- 정보처리기사 수제비
- 2020정보처리기사필기
- 정보처리기사전공자합격후기
- DST zeroshot learning
- 정보처리기사전공자
- til
- few shot dst
- How Much Knowledge Can You Pack Into the Parameters of a Language Model?
- 모두의딥러닝
- nlp논문리뷰
- dialogue state tracking
- 프로그래머스
- Zero-shot transfer learning with synthesized data for multi-domain dialogue state tracking
- SUMBT:Slot-Utterance Matching for Universal and Scalable Belief Tracking
- classification text
- DST fewshot learning
- Python
- Few Shot Dialogue State Tracking using Meta-learning
- 파이썬을 파이썬답게
- 정보처리기사 책 추천
- 다이나믹 프로그래밍
- 딥러닝기초
- 데이터 합성
- fasttext text classification 한글
Archives
- Today
- Total
🌲자라나는청년
Q1181 단어 정렬(java) 본문
반응형
도움을 받은 곳 : https://bcp0109.tistory.com/5
나의 코드:
버퍼로 입력받기 -> SET으로 넣어 중복 없에주기 -> set을 LIST로 만들어주기 -> compare를 수정하기 -> 출력
버퍼로 입력받기 :
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(bf.readLine)
Set만들고 넣기:
HashSet<String> set = new HashSet<String>();
Arraylist 로 변환하기 :
ArrayList<String> list = new ArrayList<String>(set);
compare 수정하기:
Collections.sort(list, new Comparator<String>{
public int compare(String v1, String v2){
// 1 일때 변경된다
if(v1.length()>v2.length()) return 1;
else if (v1.length()<v2.lenght()) return -1;
else{
return v1.compareTo(v2);
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
public class Q1181{
public static void main(String[] args) throws Exception{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(bf.readLine());
HashSet<String> set = new HashSet<String>();
for(int i=0; i<N; i++)
set.add(bf.readLine());
ArrayList<String> list = new ArrayList<String>(set);
public int compare(String v1, String v2){
if(v1.length()>v2.length())
return 1;
else if(v1.length()<v2.length())
return -1;
else{
return v1.compareTo(v2);
}
}
});
for(String s : list){
System.out.println(s);
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
반응형
'알고리즘 문제풀이' 카테고리의 다른 글
Q1463 1로 만들기(java) (0) | 2019.09.19 |
---|---|
Q11650 좌표정렬하기(java) (0) | 2019.09.15 |
Q1427 소트인사이드(java) (0) | 2019.09.15 |
Q1026 보물(java) (0) | 2019.09.15 |
Q9496 텀프로젝트(시간초과로 실패) (0) | 2019.05.07 |