¶
- 간. 1500개 꽉 까 1
- 2, 3, 5 .
감 ¶
. 900까 구 2 걸고,
1000까 구 7 걸...
1000까 구 7 걸...
1500꺼 구 ... 76 걸...
#include <iostream> #include <ctime> using std::cout; using std::cin; using std::endl; using std::clock_t; #define LIMIT 1500 // 계 int main() { int arr[LIMIT] = {0}, num, index = 0, target; clock_t start,end; // 간 구 고 . target = 1500; // 1500 구 . start = clock(); // 간. for(int i = 1;arr[target-1] == 0;i++) { num = i; while((num % 2) == 0) { num /= 2; } while((num % 3) == 0) { num /= 3; } while((num % 5) == 0) { num /= 5; } if(num == 1) { // 2, 3, 5 1 . arr[index] = i; // 1 그 . index++; } } end = clock(); // 간. cout << "Run time = " << (double)(end-start)/CLK_TCK << endl << arr[target-1] << endl; return 0; }
¶
고 그
sorting 각 겠 .
sorting 각 겠 .
겠고 각
각 .
각 .
2, 3, 5 거곱 고
30개까 구 그 구...
30개까 구 그 구...
거
그 ... 각...
결국 ...
그 ... 각...
결국 ...
... .