[C++] 프로그래머스 소수 찾기


[C++] 프로그래머스 소수 찾기

문제 소스 코드 #include <string> #include <vector> #include <iostream> #include <string> #include <algorithm> #include <cstdlib> #include <set> using namespace std; set<int> ans ; bool isPrime(string num) { int n = stoi(num); if(n == 1 || n == 0) return false; for(int i=2; i<=int(n/2);i++) { if(n%i == 0) { return false; } } return true; } void find_prime(vector<string> v, string cur, int idx) { //cout << "cur: " << cur; if(true == isPrime(cur)) { //cout << cur; int temp = stoi(cur); ans.insert(temp); ...



원문링크 : [C++] 프로그래머스 소수 찾기