#define USECHRONO #undef HAVE_MPI #include "eval.hpp" #include #include #include #include using namespace aed; using namespace std; //---:---<*>---:---<*>- COMIENZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> // COMPLETAR DNI y NOMBRE AQUI: // Nombre: Ambrosig Brian int DNI=41403400; //Escribir una funcion void set_prime(vector> &VS, set &S) que recibe un vector de conjuntos VS, //y que debe retornar en S la unión de todos los juntos que //tienen al menos un número primo. bool EsPrimo(int x){ int cont = 0 ; for(int i = 1 ; i <= x ; i++){ if( x%i == 0 ){ cont++; } } if(cont != 2 ){ return false; }else{ return true; } } bool TienePrimo(set S){ int contador = 0 ; for(auto x : S){ if(EsPrimo(x)){ contador++; } } if(contador >= 1){ return true; }else{ return false; } } void set_prime(vector> &VS, set &S) { //COMPLETAR! auto it = S.begin(); for(auto V : VS){ if(TienePrimo(V)){ for(auto x : V){ S.insert(x); } } } } //---:---<*>---:---<*>- FINALIZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> int main() { Eval ev; int vrbs=0; ev.eval<1>(set_prime,vrbs); return 0; }