Problem 36(Brute Force;NOT OPTIMIZED)