Skip to content

Instantly share code, notes, and snippets.

@CookieBox26
Created February 10, 2022 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CookieBox26/377e36d2bfa26223075d85698ff95e59 to your computer and use it in GitHub Desktop.
Save CookieBox26/377e36d2bfa26223075d85698ff95e59 to your computer and use it in GitHub Desktop.
Untitled.ipynb
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CookieBox26
Copy link
Author

最後が20位までプリントされるようになっているが合っていることが保証されるのは上位5位までなのでこれはミスである。

@CookieBox26
Copy link
Author

CookieBox26 commented Feb 10, 2022

残る候補のパターン(1匹の場合を除く)。

import collections

def hash_kouho(kouho):
    return ','.join(sorted(list(kouho)))

d_kouho = collections.defaultdict(set)
li_kouho = []
for pokemon_input, result in results.items():
    for gamen, kouho in result.items():
        if len(kouho) == 1:
            continue
        hash_ = hash_kouho(kouho)
        li_kouho.append(hash_)
        d_kouho[hash_].add(pokemon_input + ' --> ' + gamen)

c = collections.Counter(li_kouho)
for v in c.most_common()[:10]:
    print(v)
('デスカーン,デスバーン', 15)
('ニドリーナ,ニドリーノ', 15)
('グライガー,ブラッキー', 11)
('ラティアス,ラティオス', 11)
('サメハダー,ミツハニー', 10)
('スカタンク,ミルタンク', 10)
('アイアント,ウインディ,コイキング,ダイケンキ', 10)
('カイリキー,カイリュー', 10)
('バオッキー,バタフリー,バチンキー', 10)
('ストライク,ボスゴドラ', 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment