This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << '9' * 3 << endl;
return 0;
}

View File

@@ -0,0 +1,7 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int b = 0x212;
cout << b;
return 0;
}

View File

@@ -0,0 +1,8 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << n - n / 200 * 25;
return 0;
}

View File

@@ -0,0 +1,15 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int n, mx, pre, nxt;
int main() {
cin >> n >> pre;
for (int i = 2; i <= n; i++) {
cin >> nxt;
if (abs(nxt - pre) > mx) mx = abs(nxt - pre);
pre = nxt;
}
cout << mx;
return 0;
}

View File

@@ -0,0 +1,37 @@
#include <bits/stdc++.h>
using namespace std;
int check(int x) {
// 转9进制
string res;
while (x) {
int a = x % 9;
res += to_string(a);
x /= 9;
}
// 每个数位都是奇数
for (int i = 0; i < res.size(); i++)
if ((res[i] - '0') % 2 == 0) return 0;
// 判断转完的9进制是不是回文数
// 方法1
// string str = res;
// reverse(str.begin(), str.end());
// return str == res;
// 方法2
for (int i = 0; i < (res.size() + 1) / 2; i++)
if (res[i] != res[res.size() - 1 - i]) return 0;
return 1;
}
int main() {
int n, m;
cin >> n >> m;
int res = 0;
for (int i = n; i <= m; i++) res += check(i);
cout << res << endl;
return 0;
}

View File

@@ -0,0 +1,42 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m, ans, st[N];
int a[N][N];
bool check(int u) {
for (int i = 1; i < u; i++)
if (st[i] && a[u][i]) return false;
return true;
}
void dfs(int u, int sum) { // 第u号钻石,之前一共选了sum个钻石
if (u == n + 1) { // 如果所有钻石都找完了
ans = max(ans, sum); // 取最大值
return;
}
// 如果剩下的钻石都选也没有已有的最好情况多,返回,剪枝
// if (ans > sum + (n - u + 1)) return;
if (check(u)) { // 当前钻石与已选钻石没有冲突
st[u] = 1; // 选之
dfs(u + 1, sum + 1); // 继续下一个钻石
st[u] = 0; // 不选
}
dfs(u + 1, sum); // 继续下一个钻石
}
int main() {
cin >> n >> m;
while (m--) {
int x, y;
cin >> x >> y;
a[x][y] = a[y][x] = 1; // x<->y互相冲突
}
dfs(1, 0); // 从第一个钻石开始选,目前已选0个
cout << ans << endl;
return 0;
}

View File

@@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 31;
char a[N][N];
int n, m, cnt;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> a[i][j];
for (int e = 2; e <= min(m, n);e++){
for (int i = 0; i <= n - e;i++){
for (int j = 0; j <= m - e;j++){
bool f = true;
for (int x = 0; x < e;x++){
for (int y = 0; y < e;y++){
if(a[i][j]!=a[i+x][j+y]){
f = false;
break;
}
}
if (!f) break;
}
if (f) cnt++;
}
}
}
cout << cnt << endl;
return 0;
}

View File

@@ -0,0 +1,3 @@
https://ccgao.blog.csdn.net/article/details/134725794
https://tiku.scratchor.com/paper/view/z8k4y0xsf0ue8xlh