Precreation contest files

This commit is contained in:
2026-02-11 11:28:23 +07:00
parent 0a8ea477bb
commit cb9f7cab30
134 changed files with 1848 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,6 @@
5
6
96
78
122
696

View File

@@ -0,0 +1,5 @@
6
6
7
1
6

View File

@@ -0,0 +1,20 @@
#include <iostream>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int x;
cin >> x;
string xstr = to_string(x);
int res = 10;
for (const char &i : xstr) {
res = min(res, (int)(i - '0'));
}
cout << res << endl;
}
}

View File

@@ -0,0 +1,11 @@
5
5 1
0 1 0 0 0
7 3
0 0 0 0 0 0 0
3 1
1 1 1
4 2
0 1 0 1
6 2
0 0 1 0 0 0

View File

@@ -0,0 +1,5 @@
3
2
0
0
2

View File

@@ -0,0 +1,38 @@
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int &i : a)
cin >> i;
int res = 0;
int len = 0;
for (int i = 0; i < n; i++) {
if (len == k) {
len = 0;
res++;
continue;
}
if (a[i] == 0) {
len++;
}
if (a[i] == 1) {
len = 0;
}
}
if (len == k)
res++;
cout << res << endl;
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}

View File

@@ -0,0 +1,11 @@
5
5 3
3 2 1 4 5
3 1
1 3 4
4 4
4 4 4 2
6 2
2 3 6 9 1 2
4 2
1 2 5 6

View File

@@ -0,0 +1,5 @@
YES
NO
YES
YES
NO

View File

@@ -0,0 +1,37 @@
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (auto &i : a)
cin >> i;
int h = a[k - 1];
sort(a.begin(), a.end());
int time = 0;
for (auto H : a) {
if (H <= h)
continue;
time += H - h;
if (time > h) {
cout << "NO\n";
return;
}
h = H;
}
cout << "YES\n";
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
5
6
72 24 3 3 3 3
3 3 3 6 12 144
3
1 2 3
4 5 6
5
125 125 125 25 25
25 25 25 25 75
4
123 421 282 251
125 1981 239 223
3
124 521 125
125 121 121

View File

@@ -0,0 +1,5 @@
YES
NO
YES
NO
NO

View File

@@ -0,0 +1,48 @@
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> pre(n), stu(n);
for (int &i : pre)
cin >> i;
for (int &i : stu)
cin >> i;
if (pre[n - 1] != stu[0]) {
cout << "NO\n";
return;
}
for (int i = 0; i < n - 1; i++) {
if (pre[i] < pre[i + 1]) {
cout << "NO\n";
return;
}
if (pre[i] % pre[i + 1] != 0) {
cout << "NO\n";
return;
}
}
for (int i = n - 1; i > 0; i--) {
if (stu[i] < stu[i - 1]) {
cout << "NO\n";
return;
}
if (stu[i] % stu[i - 1] != 0) {
cout << "NO\n";
return;
}
}
cout << "YES\n";
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}