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,9 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
printf("%d\n", n - 1 + n + 1);
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

View File

@@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
int n, m;
int cnt;
bool check(int x) {
while (x) {
int r = x % 10;
if (r % 2 == 0) return false;
x /= 10;
}
return true;
}
int main() {
cin >> n >> m;
for (int i = n; i <= m; i++)
if (check(i)) cnt++;
printf("%d\n", cnt);
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

View File

@@ -0,0 +1,33 @@
#include <bits/stdc++.h>
using namespace std;
int n;
const int INF = 0x3f3f3f3f;
/*
手推4
0 0 0 0
1 1 1 0
0 0 1 1
0 1 0 0
1 1 1 1
共4步
手推5
0 0 0 0 0
1 1 1 0 0
0 0 1 1 0
1 1 1 1 1
共3步
*/
void solve(int n) {
if (n % 3 == 0)
cout << n / 3 << " ";
else if (n % 3 == 1)
cout << n / 3 - 1 + 4 << " "; // 4是4张手推结果
else
cout << n / 3 - 1 + 3 << " "; // 3是5张手推结果
}
int main() {
for (int i = 1; i <= 20; i++) solve(i);
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

View File

@@ -0,0 +1,35 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m;
int a[N][N], s[N][N];
int res;
/*
4 5
1 1 0 0 0
1 0 1 0 0
0 0 0 1 1
0 0 0 1 0
答案:6
*/
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
cin >> a[i][j];
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + a[i][j];
}
for (int x1 = 1; x1 <= n; x1++)
for (int y1 = 1; y1 <= m; y1++)
for (int x2 = x1 + 1; x2 <= n; x2++)
for (int y2 = y1 + 1; y2 <= m; y2++) {
if (s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1] == 0)
res = max(res, (x2 - x1 + 1) * (y2 - y1 + 1));
}
printf("%d\n", res);
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m;
int a[N][N], s[N][N];
int res;
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
cin >> a[i][j];
a[i][j] = !a[i][j];
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] - a[i][j];
}
for (int x1 = 1; x1 <= n; x1++)
for (int y1 = 1; y1 <= m; y1++)
for (int x2 = x1 + 1; x2 <= n; x2++)
for (int y2 = y1 + 1; y2 <= m; y2++) {
int sum = s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1];
if ((x2 - x1 + 1) * (y2 - y1 + 1) == sum)
res = max(res, sum);
}
printf("%d\n", res);
return 0;
}