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

View File

@@ -0,0 +1,16 @@
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
if (n % 4 == 0)
printf("R");
else if (n % 4 == 1)
printf("L");
else if (n % 4 == 2)
printf("S");
else if (n % 4 == 3)
printf("C");
return 0;
}

View File

@@ -0,0 +1,19 @@
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
double cnt = 0.2;
int sum = 0;
for (int i = 1;; i++) {
if (cnt > n) {
printf("%d", sum);
break;
}
cnt *= 2;
sum++;
}
return 0;
}

View File

@@ -0,0 +1,25 @@
#include <bits/stdc++.h>
using namespace std;
int a[110];
int l, r;
int n;
int sum;
int s1, s2;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sum += a[i];
}
cin >> l >> r;
if (sum < l * n || sum > r * n) {
printf("-1");
exit(0);
}
for (int i = 1; i <= n; i++) {
if (a[i] > r) s1 += a[i] - r;
if (a[i] < l) s2 += l - a[i];
}
cout << max(s1, s2);
return 0;
}

View File

@@ -0,0 +1,42 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int INF = 0x3f3f3f3f;
int n, m;
int a[N][N];
int dx[] = {-1, 0, 1, 0}; //上右下左
int dy[] = {0, 1, 0, -1}; //上右下左
int res;
/*
3 3
3 2 1
3 4 5
2 1 3
答案:
4
*/
void dfs(int x, int y, int last, int cnt) {
res = max(res, cnt);
for (int i = 0; i < 4; i++) {
int tx = dx[i] + x, ty = dy[i] + y;
if (tx <= 0 || tx > n || ty <= 0 || ty > m) continue;
if (a[tx][ty] < last)
dfs(tx, ty, a[x][y], cnt + 1);
}
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
cin >> a[i][j];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
dfs(i, j, INF, 0);
printf("%d\n", res - 1);
return 0;
}