#include #include using namespace std; bool isPrime(long num){ bool flag=true; for(long i = 2; i <= sqrt(num); i++) { if(num % i == 0) { flag = false; break; } } return flag; } long divisor(long num) { long i; for(i=2;i a) { // Return the length of the longest possible sequence of moves. vector::iterator it; long s=0; for(it=a.begin();it!=a.end();it++) { bool ans = isPrime(*it); long temp = *it; if(temp==1) s+=1; else if(ans) s+=(*it)+1; else if(!ans) { //cout<<"hey"<> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long result = longestSequence(a); cout << result << endl; return 0; }