fork download
  1. /**
  2.  * author: orzvanh14 ( Độc cô cầu đặc )
  3.  * created: 23.12.2022 10:08:02
  4.  * too lazy to update time
  5. **/
  6. // i wants to take ioi
  7. //binhtinhtutinkhongcaycunhungmotkhikhongcontutinnualatuyetvong
  8. #include <bits/stdc++.h>
  9.  
  10. using namespace std;
  11.  
  12. #define int long long
  13. #define nn "\n"
  14. #define pi pair<int, int>
  15. #define fi first
  16. #define se second
  17. #define lb lower_bound
  18. #define ub upper_bound
  19. #define eb emplace_back
  20. #define pb push_back
  21. #define TASK " "
  22.  
  23. #define ms(a, x) memset(a, x, sizeof(a))
  24. #define all(a) a.begin(), a.end()
  25. #define All(a, n) a + 1, a + 1 + n
  26.  
  27. #define LOG 19
  28.  
  29.  
  30. const int INF = 1e18;
  31. const int mod = 1e9+7;
  32. const int N = 1e7 + 5;
  33. const int maxn = 1e3 + 5;
  34. int MOD = 998244353;
  35. int bit[200000];
  36. struct node{
  37. int kc, u, hk;
  38. bool operator<(const node& other) const {
  39. return kc > other.kc;
  40. }
  41. };
  42. struct edge{
  43. int v, w, h;
  44. };
  45. int l, r;
  46. bool p[N];
  47. int uoc[N];
  48. int dem = 0;
  49. void nhap(){
  50. cin >> l >> r;
  51. }
  52. void sang(){
  53. p[1] = 1;
  54. for(int i = 2; i < N; i++){
  55. if(!p[i]){
  56. for(int j = i; j < N; j += i){
  57. uoc[j]++;
  58.  
  59. }
  60. for(int j = i * i; j < N; j += i) p[j] = 1;
  61. }
  62. }
  63. }
  64. bool ok(int n){
  65. string s = to_string(n);
  66. int l = 0, r = s.size() - 1;
  67. while(l <= r){
  68. if(s[l] == s[r]){
  69. l++;
  70. r--;
  71. }
  72. else return false;
  73. }
  74. return true;
  75. }
  76. void solve(){
  77. sang();
  78. for(int i = l; i <= r; i++){
  79. if(ok(i) && uoc[i] >= 3) dem++;
  80. }
  81. cout << dem << nn;
  82. }
  83. // 0 0 0 0 0 0 0
  84. signed main() {
  85. // freopen("WORK.INP", "r", stdin);
  86. // freopen("WORK.OUT", "w", stdout);
  87. ios_base::sync_with_stdio(0);
  88. cin.tie(0);
  89. cout.tie(0);
  90. nhap();
  91. solve();
  92. return 0;
  93.  
  94. }
  95. // https://i...content-available-to-author-only...e.com/7poJyz
  96. // https://i...content-available-to-author-only...e.com/pScgCp
  97. // https://i...content-available-to-author-only...e.com/DFHWaU
Success #stdin #stdout 0.33s 91616KB
stdin
Standard input is empty
stdout
0