test questions A: Nine to decimal
Send points

test questions B: Shunzi date
Python Write a loop traversal judgment

test questions C: Brush question statistics
division

test questions D: Pruning shrubs
Maximum distance between two sides of each point

test questions E: X Binary subtraction
It should be greedy , Casually , Wrong
#include<iostream> #include<algorithm> #include<cmath> using namespace std; #
define int long long #define p 1000000007 int n; int lena,lenb; int a[100010], b
[100010]; signed main() { cin>>n; cin>>lena; for(int i=1;i<=lena;i++) cin>>a[i];
cin>>lenb; for(int i=lena-lenb+1;i<=lena;i++) cin>>b[i]; int sum=0, last=1; for
(int i=lena;i>0;i--){ int x=0; if(a[i]==0&&b[i]==0) x=2; else x=max(a[i],b[i])+1
; sum += (a[i]-b[i])*last%p; last*=x; } cout<<sum; return 0; }
test questions F: Statistical submatrix
The prefix sum is transformed into a one-dimensional problem , Sum of subsequences , Triple cycle

test questions G: Building block painting
DP once

test questions H: mine clearance
Direct mapping + Get a minimum score for violence

test questions I: Li Bai's enhanced version
DP
# include<iostream> # include<cmath> # include<cstring> using namespace std; #
define int long long #define p 1000000007 int n, m; int dp[105][105][105];
signed main() { cin >> n >> m; memset(dp, 0, sizeof dp); dp[0][0][2] = 1; for (
int i=0;i <= n;i++) for (int j=0;j <= m;j++) { if (i == 0 & & j == 0) continue;
for (int k = 0; k <= m; k++) { if (j > 0) dp[i][j][k] += dp[i][j - 1][k + 1]; if
(i > 0 & & k % 2 == 0) dp[i][j][k] += dp[i - 1][j][k / 2]; } } cout << dp[n][m -
1][1]; return 0; }
test questions J: Chop bamboo
greedy + simulation
# include<iostream> # include<algorithm> # include<cmath> # include<vector>
using namespace std; # define int long long # define N 200010 int n,ans; vector<
int>vec; int get(int h){ return floor(sqrt(h / 2 + 1)); } signed main() { //
Trim from high to low , Continuous consolidation cin >> n; for (int i=1;i <= n;i++) { int x;cin>>x; vec.push_back(
x); } while(++ans){ auto maxx = max_element(vec.begin(), vec.end()); *maxx = get
(*maxx); while(maxx+1!=vec.end()&&*maxx==*(maxx+1)) maxx++; while(maxx!=vec.
begin()&&*maxx == *(maxx-1)) vec.erase(maxx),maxx--; if(vec.size()==1&&vec[0]==1
) break; } cout<<ans; return 0; }

Technology
Daily Recommendation
views 267
views 232
views 231