<>A beautiful 2

code :
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio>
#include<cmath> #include<queue> #include<vector> using namespace std; #define
ll long longint int k(int a) { int sum=0; while(a) { int k=a%10; if(k==2) {
return 1; } a/=10; } } int main() { int sum=0; for(int i=2;i<=2020;i++) { sum+=k
(i); } cout<<sum<<endl; return 0; } //563
<>B spread

code :
#include<cstring> #include<algorithm> #include<cstdio> #include<cmath> #define
mp make_pair #include<queue> #include<vector> #include<map> using namespace
std; #define ll long long int a[10005][10005],vis[10005][10005];// Indicates whether it has been searched int
d[4][2]={0,1,1,0,0,-1,-1,0}; // direction , Four Unicom ll ans=0; // gross value struct point{
//xy Coordinate value ,t How many seconds for time int x,y,t; }; void bfs() // Wide search { queue<point> q; // queue point z,s;
// Two points z.x=0,z.y=0,z.t=0;q.push(z); // Join the team z.x=2020,z.y=11,z.t=0;q.push(z);
z.x=11,z.y=14,z.t=0;q.push(z); z.x=2000,z.y=2000,z.t=0;q.push(z);
vis[0][0]=vis[2020][11]=vis[11][14]=vis[2000][2000]=1; // sign
while(!q.empty())// If the queue is not empty { z=q.front();//z= Team leader q.pop();// Get out of the team for(int
i=0;i<4;i++)// Four links map { s.x=z.x+d[i][0];//+ s.y=z.y+d[i][1]; s.t=z.t+1;// The number of seconds is the last time +1
if(vis[s.x][s.y]==0&&s.t<=2020)// If not searched and not greater than 2020 second { vis[s.x][s.y]=1;// The mark has been searched
ans++;// gross value ++ q.push(s);// Join the team } } } cout<<ans+4<<endl;// Add the original four points } int main() {
bfs();// Wide search return 0; } //20312088
<>C Factorial divisor

code :
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio>
#include<cmath> #include<queue> #include<vector> using namespace std; #define
ll long long int flag[105]; int main() { int i; for (int i = 2; i <= 100; i++) {
int tmp = i; for (int j = 2; j <= tmp; j++) { while (tmp % j == 0) { tmp /= j;
flag[j]++; } } } ll ans = 1; for (int i = 1; i <= 100; i++) { ans *= flag[i] + 1
; } cout << ans; } //39001250856960000
<>D Essential ascending sequence

code :
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio>
#include<cmath> #define mp make_pair #include<queue> #include<vector>
#include<map> using namespace std; #define ll long long map<string, int> vis;
int main() { queue<pair<string, int> > q; string s; cin >> s; int i; ll ans = 0;
for(i = 0; i < s.size(); i++) { string tmp = ""; tmp += s[i]; if (!vis[tmp]) {
vis[tmp] = 1; q.push(mp(tmp, i)); ans++; } } while (q.size()) { string t = q.
front().first; int pos = q.front().second; q.pop(); for (int i = pos + 1; i < s.
size(); i++) { if (s[i] > s[pos] && !vis[t + s[i]]) { vis[t + s[i]] = 1; q.push(
mp(t + s[i], i)); ans++; } } } cout << ans; } //3616159
<>E paper serpent

code :
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio>
#include<cmath> #define mp make_pair #include<queue> #include<vector>
#include<map> using namespace std; #define ll long long int vis[5][5]; int
nexti[4][2] = { {0,1},{1,0},{0,-1},{-1,0} }; ll ans = 0; void dfs(int x, int
y,int count) { if (x >= 4 || x < 0 || y >= 4 || y < 0)return; if (count == 16) {
ans++; } for (int i = 0; i < 4; i++) { int nx = x + nexti[i][0]; int ny = y +
nexti[i][1]; if (!vis[nx][ny]) { vis[nx][ny] = 1; dfs(nx, ny, count + 1);
vis[nx][ny] = 0; } } } int main() { int i; for (i = 0; i < 4; i++) { for (int j
= 0; j < 4; j++) { vis[i][j] = 1; dfs(i, j, 1); vis[i][j] = 0; } } cout << ans;
} //552 One excellent question , Three questions pot three , Six questions

Technology