algospot http://algospot.com/judge/problem/read/WEIRD#
해결