Gooooogle • 6个月前
#include <iostream>
#include<cmath>
using namespace std;
int main() {
int A, B, D, count = 0, flage;
scanf("%d%d%d", &A, &B, &D);
for (int i = A; i <= B; i++) {
flage = 0;
for (int j = 2; j<=sqrt(i); j++) {
if (i % j == 0) {
flage++;
break;
}
}
int e = i;
if (flage == 0) {
while (e > 0) {
int o = e % 10;
e = e / 10;
if (o == D) {
count++;
break;
}
}
}
}
printf("%d",count);
return 0;
}
评论:
请先登录,才能进行评论