Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created January 12, 2014 03:19
Show Gist options
  • Save cocodrips/8380327 to your computer and use it in GitHub Desktop.
Save cocodrips/8380327 to your computer and use it in GitHub Desktop.
SRM604 div2 easy
import math
import string
class FoxAndWord:
def howManyPairs(self, words):
cnt = 0
for i, word in enumerate(words):
for j in xrange(i + 1, len(words)):
if len(words[j]) != len(words[i]): #Contest中書き忘れたとこ。
continue
if (words[j]+words[j]).find(word) >= 0:
cnt += 1
return cnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment