1.AcWing 4203. 寻找子串
原代码:
这样写就挺好,不用补了qwq
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin >> a;
if(a.find("1111111")!=-1 || a.find("0000000")!=-1 ) cout << "YES";
else cout << "NO";
return 0;
}
2.AcWing 4204. 构造矩阵
补题代码:
0x3f大神说得就挺好 https://www.acwing.com/activity/content/code/content/2216638/
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N][N];
int main()
{
int n;
cin >> n;
for (int i = 0;i < n-1;i ++)
{
for (int j = 0;j < n-1;j ++)
{
a[i][j] = ((j + i) % (n - 1)) + 1;
}
}
for (int i = 0;i < n-1;i ++)
{
a[i][n-1] = a[n-1][i] = a[i][i];
a[i][i] = 0;
}
for (int i = 0;i < n;i ++)
{
for (int j = 0;j < n;j ++)
cout << a[i][j] << ' ';
cout << endl;
}
return 0;
}
3.AcWing 4205. 树的增边
学了图论再来补这题。。。