ICPC-2 Code: P24 Specific learning problem