POJ 1207 求最大数链长度 暴力枚举数学题

这个题目直接用的暴力枚举,但是还是WA了几次

原因是这句话You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j. 

注意i可能大于j,此时需要交换顺序,但是输出的时候还会是原始顺序

比如 输入1 10 输出 1 10 20 ;输入10 1 输出 10 1 20

因此交换i和j需要用标志位记录一下

Source Code

Problem: 1207   User: yangliuACMer
Memory: 244K   Time: 16MS
Language: C++   Result: Accepted


posted @ 2012-02-10 21:57  yangleo  阅读(206)  评论(0编辑  收藏  举报