U E D R , A S I H C RSS

소수구하기/영록

1 50000 ..
~cpp 
#include <iostream> 
using namespace std; 
#include <ctime> 
 
void main() 
{ 
		clock_t start = clock(); 
        int counter = 0; 
                for(int i = 1; i <= 50000; i++) 
                { 
                        counter=0; 
                        for (int j = 1; j <= i; j++) 
                        {                                
                                if(i%j == 0) 
                                        counter++; 
                        } 
                 if (counter == 2) 
                        cout << i << "\n"; 
                } 
		clock_t end = clock() - start; 
        cout << (double)end/CLOCKS_PER_SEC << "\n"; 

}   68.77 ........ ........ 

     ..... ㅠ_ㅠ

-_-;; .... . .. -_-;
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:13
Processing time 0.0064 sec