(1)

Directly from for Cycle from 10000 Enumerate to 90000, If i%128==0, The answer is +1;

(2)

  This problem is also enumeration .

(3)

Only the corresponding number can be placed in the odd position , Even position full arrangement , The answer is 10 factorial .

(4)

 

The problem is straightforward DFS Just a minute , The answer is 4;
#include <bits/stdc++.h> #define CLOSE
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) //const int N=1e6; typedef
long long ll; using namespace std; int
a[20]={0,1,2,1,1,1,1,5,5,4,-1,-1,-2,-3,-1,-9}; int ans=INT_MIN; void dfs(int
i,int x,int sum)//i What is the step ,x Is the number of steps ,sum Score for { if(i>=7)// exceed 7 Step , wrongful { return; }
if(x==15)// Arrive at No 15 Layer { ans=max(ans,sum); return; } for(int j=1;j<=4;j++) {
dfs(i+1,x+j,sum+=a[x+j]); } } int main() { dfs(1,0,0); cout<<ans<<endl; return
0; }
(5)

This question is also enumeration .. three layers for Circular enumeration i,j,k.

(6)

(7)

Easy to observe : Number of rows i+ Number of columns j Even numbers are dyed black . So the answer : Number of odd rows * Number of odd columns + Number of even rows * Number of even columns .

(8)

  Let's enumerate directly a[i]-a[i-1], Then let this length be removed to k, Pay attention to the first and last pieces .

(9)

thinking + Combination number , The first (n+1)/2 It must be the maximum n, We just need to choose (n-1)/2 Just put it in front , The selected position is determined , Pay attention to mold taking .
#include <bits/stdc++.h> #define CLOSE
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) //const int N=1e6; typedef
long long ll; const ll mod=1000000007; using namespace std; ll n; ll C(ll a,ll
b) { ll x=1; for(ll i=a,j=1;j<=b;i--,j++) { x=(x*i/j)%mod; } return x; } int
main() { cin>>n; n--; ll ans=C(n,n/2); cout<<ans<<endl; return 0; }
 (10)

BFS Template question , We start from any one 1 start bfs, Mark all the places you visit ,bfs After completion , ergodic st array , If encountered 1 The position of has not been marked , It must not be connected .

#include <bits/stdc++.h> #define CLOSE
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) const int N=510; typedef
long long ll; using namespace std; char a[N][N]; int st[N][N]; int n,m; int
wy[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; int qdx,qdy; struct node{ int x,y; };
queue <node> q; void bfs() { st[qdx][qdy]=1; q.push({qdx,qdy});
while(!q.empty()) { node one=q.front(); q.pop(); for(int i=0;i<=3;i++) { int
xx=one.x+wy[i][0],yy=one.y+wy[i][1];
if(xx>=1&&xx<=n&&yy>=1&&yy<=m&&a[xx][yy]=='1'&&st[xx][yy]==0) { st[xx][yy]=1;
q.push({xx,yy}); } } } } int main() { cin>>n>>m; for(int i=1;i<=n;i++) {
for(int j=1;j<=m;j++) { cin>>a[i][j]; if(a[i][j]=='1') { qdx=i,qdy=j; } } }
bfs(); int flag=0; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) {
if(a[i][j]=='1'&&st[i][j]==0) { flag=1; } } } if(flag==1) cout<<"NO"<<endl;
else cout<<"YES"<<endl; return 0; }

Technology
©2019-2020 Toolsou All rights reserved,
( Super detail )Eclipse Using tutorials —— use Eclipse Create first HelloWorld! Database operation 5 code implementation mysql Addition, deletion, modification and query of database What can MCU do , Do you have any interesting works made by MCU or open source hardware Go to the interview after reading this , Steady over ~~ Single linked list of primary data structure (C Language implementation )SQL Comprehensive questions Employee unit comprehensive questions Python Implementation of Hanoi Tower code VHDL——JK trigger It's over , Starting salary 30k