<> I thought that if I saved the memory, I would not take the national competition , So it won't , Not yet , Many people answered yes 25.

<> First, use the Euler sieve to sun out the prime number , Then it's just a matter of judging one by one , be careful 0 and 1 Not prime ( I forgot at first , But fortunately, it was found out later ), The answer should be 1903 1903 190
3.
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N
= 20210605 + 5, mod = 1e9 + 7; int n = 20210605, p[N], cnt, res; bool vis[N];
void get() { vis = vis = 1; //vis[i] = 1 It means it has been sifted out for(int i = 2; i <= n; i++)
{ if(!vis[i]) p[cnt++] = i; for(int j = 0; p[j] <= n / i; j++) { vis[p[j] * i] =
1; if(i % p[j] == 0) break; } } } bool check(int x) { while(x) { int y = x % 10;
x/= 10; if(vis[y]) return false; } return true; } int main() { get(); for(int i
= 0; i < cnt; i++) { int x = p[i]; if(check(x)) res++; } cout << res; return 0;
}

<> Use one first d a y day day Print the days of each month in an array , And make a special judgment for leap years 2 month , Just write another function that increases with time , The answer should be 977 977 977
.
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N
= 1e5 + 5, mod = 1e9 + 7; struct Time { int y, m, d; }; int res, day[] = {0, 31,
28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; void add(Time &a) { a.d++; int x =
day[a.m]; if(((a.y % 4 == 0 && a.y % 100 != 0) || a.y % 400 == 0) && a.m == 2) x
++; // Special leap year 2 month if(a.d > x) a.m++, a.d = 1; if(a.m > 12) a.y++, a.m = 1; } bool
check(Time a) { int s[] = {a.y, a.m, a.d}, y = 0; for(int i = 0; i < 3; i++) {
int x = s[i]; while(x) { y += x % 10; x /= 10; } } int z = sqrt(y); return z * z
== y; } int main() { Time a = {2001, 1, 1}, b = {2021, 12, 31}; while(a.y != b.y
|| a.m != b.m || a.d != b.d) { if(check(a)) res++; add(a); } cout << res; return
0; }

<> Neither can I , It is said that d p dp dp To do , I guess it might be a complete binary tree , I forgot the last answer , A big number .

#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N
= 1e5 + 5, mod = 1e9 + 7; int main() { string s; cin >> s; for(auto &x : s) if(x
>= 'a' && x <= 'z') x = x - 'a' + 'A'; cout << s; return 0; }

<> First set No i i i Blocks are from 1 1 1 reach i i i This string of numbers , For the following description , First, we preprocess the number of left and right endpoints of each block , One more s u
m sumsum Before array record i i i Sum of blocks , Then for each group l o w e r b o u n d lowerbound lowerbound Function solution
l ll and r r r Block where ( Separately recorded as i d 1 id1 id1 and i d 2 id2 id2), And then find out l l l and r r r Position in block ( Separately recorded as
i d l idlidl and i d r idr idr), If you can get it directly in the same block first ( i d r − i d l + 1 ) ∗ ( i d l +
i d r ) / 2 (idr-idl+1)*(idl+idr)/2(idr−idl+1)∗(idl+idr)/2
, Find out if you're not here l The sum to the right endpoint of its block, and r Sum to the left endpoint of its block , The sum between the last two blocks is s u m [ i d 2 − 1 ] − s u m [
i d 1 ] sum[id2-1]-sum[id1]sum[id2−1]−sum[id1], The answer is to add the three parts .
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int
maxn= 1414214, N = maxn + 5, mod = 1e9 + 7; ll l[N], r[N], sum[N], T; int main()
{ cin >> T; for(ll i = 1; i <= maxn; i++) { l[i] = r[i - 1] + 1; r[i] = l[i] + i
- 1; sum[i] = sum[i - 1] + (1 + i) * i / 2; } while(T--) { ll L, R, res; cin >>
L>> R; ll id1 = lower_bound(r, r + maxn, L) - r; ll id2 = lower_bound(r, r +
maxn, R) - r; if(id1 == id2) res = (R - L + 1) * (R - l[id1] + L - l[id1] + 2) /
2; else { ll sum1 = sum[id2 - 1] - sum[id1]; ll idl = L - l[id1] + 1, idr = R -
l[id2] + 1; // reach L and R Position in block ll suml = (id1 - idl + 1) * (id1 + idl) / 2; ll sumr =
(1 + idr) * idr / 2; //cout << sum1 << ' ' << suml << ' ' << sumr << endl; res =
sum1+ suml + sumr; } cout << res << endl; } return 0; }

<>
I figured out the rules based on the XOR algorithm , Section 1 The cyclic section of bit is 1, Section 2 Bit yes 2, Section 3,4 Bit yes 4, Section 5,6,7,8 Bit yes 8( I only pushed it to No 5 position , Made a bold guess , The cyclic section of each bit should be greater than or equal to the minimum of its digits 2 Power of ), So I'll preprocess each bit's loop section first , use
b bb Array to save , Then I opened a two-dimensional b o o l bool bool number ( Kaicheng b o o l bool bool Type is to save space ) Record No i i i
Cycle of bits j j j Results of times , n n n Max 10000, So Kaicheng a n s [ 10005 ] [ 16400 ] ans a
ns That's enough , Finally, by recursion a n s [ i ] [ j ] = a n s [ i − 1 ] [ ( j − 1 )
% b [ i − 1 ] ] ans[i][j]=ans[i-1][(j-1)\%b[i-1]]ans[i][j]=ans[i−1][(j−1)%b[i−1]
] ⨁ \bigoplus ⨁ a n s [ i ] [ j − 1 ] ans[i][j-1] ans[i][j−1]. The time complexity is about O ( n 2
) O(n^2)O(n2).
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N
= 1e4 + 5, M = 16400, mod = 1e9 + 7; char s[N]; int n, b[N]; ll t; bool a[N],
ans[N][M]; int f(int x) { int l = 0, r = 14; while(l < r) { int mid = l + r >> 1
, y = 1 << mid; if(y >= x) r = mid; else l = mid + 1; } return 1 << l; } int
main() { cin >> n >> t >> (s + 1); for(int i = 1; i <= n; i++) { a[i] = s[i] -
'0'; b[i] = f(i); ans[i] = a[i]; } for(int i = 2; i <= n; i++) for(int j = 1;
j< b[i]; j++) ans[i][j] = ans[i - 1][(j - 1) % b[i - 1]] ^ ans[i][j - 1]; for(
int i = 1; i <= n; i++) cout << ans[i][t % b[i]]; return 0; }

<> digit d p dp dp Board questions , Preprocess the number of combinations first , And then find out N N N Binary number of , If from left to right i i i Bit is 1 1 1, Let's set it to 0 0 0
, Then record how many are in front of it 1 1 1( use l a s t last last express ), For the following n − i − 1 n-i-1 n−i−1
Bits can be directly obtained by combining numbers C [ n − i − 1 ] [ K − l a s t ] C[n-i-1][K-last] C[n−i−1][K−last]
, If it l a s t last last Already greater than K K K Just go straight b r e a k break break, The last special judgment N N N Are you satisfied
K KK individual 1 1 1 All right .
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N
= 60 + 5; ll c[N][N], k; string f(ll x) // hold x Convert to binary { string s; while(x) { char y
= x % 2 + '0'; x /= 2; s = y + s; } return s; } ll get(ll x) { string s = f(x);
int n = s.size(), last = 0, flag = 1; ll res = 0; for(int i = 0; i < n; i++) {
if(s[i] == '1') { res += c[n - i - 1][k - last]; last++; if(last > k) { flag = 0
; break; } } } return res + flag; } int main() { for(int i = 0; i < N; i++) for(
int j = 0; j <= i; j++) { if(j) c[i][j] = c[i - 1][j - 1] + c[i - 1][j]; else c[
i][j] = 1; } ll n; cin >> n >> k; cout << get(n); return 0; }
<> Neither of the last two questions , It's all violence to cheat points

Technology
Daily Recommendation