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


  This problem is also enumeration .


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



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; }

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



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 .


  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 .


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; }

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
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; }

©2019-2020 Toolsou All rights reserved,
Redis Underlying data structure A person who dissuades others from learning computer , Are not good people win10 System computer C Where's the disc ,c disc users where? (win10c Disk not found users) Freshman c Language student management system ( lower ) hospital WIFI Which family is strong ? utilize Python Script unlimited spoof girlfriend computer C language program design —— Student management system Byte runout - Test development practice - One side cool meridian python Run code at specified time 5 Best style Linux Server system recommendation Anti anxiety life after naked resignation , I believe everything will have the best arrangement