④2018=5.5-7.1

 2/50


 

Some of the hyperlinks have topics, which can be easily analyzed. Most of them are for self-reflection and reflection. Many ideas and topics come from various sources. Most of them have attached codes, and you need to search the engine by yourself.

Some of the questions are examples in the book, and the questions may not be found on the Internet.

Pikapi, the fourth pit!

The algorithms that have been involved so far include:

1. Grid Repainting 2 (AtCoder) (simulation)

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<cstdlib>
 5 #include<algorithm>
 6 using namespace std;
 7 int read(){
 8     int f=1,x=0; char c=getchar();
 9     while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
10     while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
11     return f*x;
12 }
13 int h,w;
14 bool flag=1;
15 char map[55][55];
16 int main(){
17     cin>>h>>w;
18     for(int i=1;i<=h;i++) scanf("%s",map[i]+1);
19     for(int i=1;i<=h;i++)
20         for(int j=1;j<=w;j++)
21             if(map[i][j]=='#'){
22                 if((map[i][j+1]=='.')&&(map[i][j-1]=='.')&&
23                     (map[i-1][j]=='.')&&(map[i+1][j]=='.'))    {
24                         flag=0;
25                         break;
26                     }
27             }
28     if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
29     return 0;
30 }
Grid Repainting 2

2. Five, Five Everywhere (AtCoder) (screening method, thinking questions)

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<cstdlib>
 5 #include<algorithm>
 6 #include<cmath>
 7 using namespace std;
 8 int read(){
 9     int f=1,x=0; char c=getchar();
10     while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
11     while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
12     return f*x;
13 }
14 const int MAXN=55555;
15 int b,c=0,B[10000],n,d,C[10][100],f,D[10];
16 bool A[MAXN]; 
17 bool check(int e){
18     int a=sqrt(e);
19     int i=2;
20     while((i<=a)&&(e%i!=0))i++;
21     if(i<=a)return 0;
22     return 1;
23 }
24 int main(){
25     for(int i=2;i<=MAXN;i++)A[i]=1;
26     for(int i=2;i<=MAXN;i++)
27         if(A[i]){
28             f=i;
29             D[f%10]++;
30             C[f%10][D[f%10]]=f;
31             int a=i+i;
32             while(a<=MAXN){
33                 A[a]=0;
34                 a+=i;
35             }
36         }
37     cin>>n;
38     for(int i=1;i<10;i++)
39         if(i%2!=0&&D[i]>=n){
40             for(int j=1;j<=n;j++)printf("%d ",C[i][j]);
41             break;
42         }
43     return 0;
44 }
Five, Five Everywhere

Under construction…

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325317568&siteId=291194637
5.5