Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.
Xem code AC
```cpp
#include
using namespace std;
int sum (unsigned long long n) {
int sum=0;
if (n<=9) return n;
while (n>0) {
sum+=n%10;
n/=10;
}
return sum;
}
bool prime (unsigned long long n) {
if (n<2) return false;
else {
for (int i=2; i*i<=n; ++i) {
if (n%i==0) return false;
}
}
return true;
}
int main() {
unsigned long long a, b, fibo[100000], f[100000], dem=0;
cin >> a >> b;
fibo[0]=0;
fibo[1]=1;
fibo[2]=1;
for (int i=3; i<=b/2; ++i) {
fibo[i]=fibo[i-2]+fibo[i-1];
}
for (int i=0; i<=fibo[b]; ++i) {
f[i]=0;
}
for (int i=0; i<=b/2; ++i) {
++f[fibo[i]];
}
for (int i=a; i<=b; ++i) {
if (prime(i) && f[sum(i)]>=1) cout << i << " ";
}
return 0;
}
```
Chi tiết bài tập - Luyện Code Online
https://luyencode.net/problem/FH_04_04