這題難,用篩子法並且強化,把每個number的質因數相乘之後做排序,就可以得知下一個順序是哪位 2 4 8 16 32 ........3 6 9 所以如果下一個的質因數相乘不是上一個的話,就代表已經超過MAX範圍了 //============================================================================ // Name : Next Same-Factored.cpp // Date : 2013/3/30 上午12:42:53 // Author : GCA //============================================================================ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <climits> #include <vector> #include <set> #include <map> #include <queue> #include <cctype> #include <utility> using namespace std; #ifdef ONLINE_JUDGE #define ll "%lld" #else #define ll "%I64d" #endif typedef unsigned int uint; typedef long long int Int; #define Set(a,s) memset(a,s, sizeof (a)) #define Write(w) freopen(w, "w" ,stdout) #define Read(r) freopen(r, "r" ,stdin) #define Pln() prin...