From ee04e8c543a3dd57638bf78ddea8414031441b7c Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Thu, 11 Dec 2025 23:59:31 +0900 Subject: [PATCH] =?UTF-8?q?[20251211]=20PGM=20/=20LV2=20/=20=EB=89=B4?= =?UTF-8?q?=EC=8A=A4=20=ED=81=B4=EB=9F=AC=EC=8A=A4=ED=84=B0=EB=A7=81=20/?= =?UTF-8?q?=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...54\354\212\244\355\204\260\353\247\201.md" | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 "LiiNi-coder/202512/11 PGM \353\211\264\354\212\244 \355\201\264\353\237\254\354\212\244\355\204\260\353\247\201.md" diff --git "a/LiiNi-coder/202512/11 PGM \353\211\264\354\212\244 \355\201\264\353\237\254\354\212\244\355\204\260\353\247\201.md" "b/LiiNi-coder/202512/11 PGM \353\211\264\354\212\244 \355\201\264\353\237\254\354\212\244\355\204\260\353\247\201.md" new file mode 100644 index 00000000..b5670108 --- /dev/null +++ "b/LiiNi-coder/202512/11 PGM \353\211\264\354\212\244 \355\201\264\353\237\254\354\212\244\355\204\260\353\247\201.md" @@ -0,0 +1,45 @@ +```java +import java.util.*; + +class Solution { + private static Map map; + public int solution(String str1, String str2) { + map = new HashMap(); + pushSet(str1, 0); + pushSet(str2, 1); + + int bunja = 0; + int bunmo = 0; + for(Map.Entry entry: map.entrySet()){ + int[] v = entry.getValue(); + bunja += Math.min(v[0], v[1]); + bunmo += Math.max(v[0], v[1]); + } + + if(bunmo == 0) + return 65536; + + return (int)( (bunja /(float)bunmo) * 65536 ); + } + + private void pushSet(String str, int index){ + char[] cs = str.toCharArray(); + for(int i = 0; i < cs.length - 1; i++){ + char a = cs[i]; + char b = cs[i + 1]; + if(!Character.isLetter(a) || !Character.isLetter(b)) + continue; + a = Character.toLowerCase(a); + b = Character.toLowerCase(b); + + String key = "" + a + b; + + if(!map.containsKey(key)) + map.put(key, new int[2]); + + map.get(key)[index]++; + } + } +} + +```