This problem is in Contest(s) below:
Contest 1314:Java技术16级程序设计竞赛课程测试1
Contest 1268:cccc预热赛(二)