소스 ¶
~cpp #include <iostream.h> #include <ctime> int main() { clock_t start = clock(); int premium[5133], count = 0; premium[0] = 2; cout << "2\n"; for (int i = 3 ; i <= 50000 ; ++++i) for (int j = 0 ; j <= count ; j++) { if (i % premium[j] == 0) break; if (premium[j] > i / 3) { count++; premium[count] = i; cout << premium[count] << ' '; break; } } clock_t end = clock() - start; cout << (double)end/CLOCKS_PER_SEC << "초\n"; return 0; }