Created
July 1, 2017 15:23
-
-
Save IKKO-Ohta/a994597c32b9f49d22fea8cc8da4f1b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myfind(coin_self,all_coins): | |
""" | |
目標コインとコイン全体を引数に取る。 | |
その目標コインが約数に取り得るコインが何枚あるか(S)を返す。 | |
""" | |
factor = -1 | |
for c in coins: | |
if coin_self % c == 0: factor += 1 | |
return factor | |
if __name__ == '__main__': | |
N = int(input()) | |
coins = [] | |
for i in range(N): coins.append(int(input())) | |
accum = 0 | |
for coin in coins: | |
S = myfind(coin,coins) | |
if S % 2 == 0: accum += (S+2) / (2*S+2) | |
else: accum += 0.5 | |
print(accum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment