'commit'
This commit is contained in:
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/1.jpg
Normal file
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
11
TangDou/LanQiaoBei/LanQiao13STEMA202201/2.cpp
Normal file
11
TangDou/LanQiaoBei/LanQiao13STEMA202201/2.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string s; // ABC,00001
|
||||
cin >> s;
|
||||
for (int i = s.size() - 1; i >= 0; i--)
|
||||
cout << s[i];
|
||||
return 0;
|
||||
}
|
||||
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/2.jpg
Normal file
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
23
TangDou/LanQiaoBei/LanQiao13STEMA202201/3.cpp
Normal file
23
TangDou/LanQiaoBei/LanQiao13STEMA202201/3.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
const int N = 110;
|
||||
int a[N];
|
||||
/*
|
||||
9 4 3 8 8 9 11 9 8 5
|
||||
10
|
||||
*/
|
||||
int n;
|
||||
int res = -1;
|
||||
int main() {
|
||||
for (int i = 1; i <= 10; i++) cin >> a[i];
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= 10; i++)
|
||||
for (int j = i + 1; j <= 10; j++)
|
||||
if (a[i] + a[j] <= n)
|
||||
res = max(res, a[i] + a[j]);
|
||||
|
||||
printf("%d", res);
|
||||
return 0;
|
||||
}
|
||||
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/3.jpg
Normal file
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
33
TangDou/LanQiaoBei/LanQiao13STEMA202201/4.cpp
Normal file
33
TangDou/LanQiaoBei/LanQiao13STEMA202201/4.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
const int N = 15;
|
||||
const int INF = 0x3f3f3f3f;
|
||||
int a[N];
|
||||
int n;
|
||||
int cha = INF;
|
||||
int res1, res2;
|
||||
/*
|
||||
3
|
||||
200 300 110
|
||||
*/
|
||||
void dfs(int u, int s1, int s2) {
|
||||
if (u == n + 1) {
|
||||
if (s1 < s2) swap(s1, s2);
|
||||
if (s1 - s2 < cha) {
|
||||
res1 = s1, res2 = s2;
|
||||
cha = s1 - s2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
dfs(u + 1, s1 + a[u], s2);
|
||||
dfs(u + 1, s1, s2 + a[u]);
|
||||
}
|
||||
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) cin >> a[i];
|
||||
dfs(0, 0, 0);
|
||||
printf("%d %d\n", res1, res2);
|
||||
return 0;
|
||||
}
|
||||
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/4.jpg
Normal file
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
1
TangDou/LanQiaoBei/LanQiao13STEMA202201/5.drawio
Normal file
1
TangDou/LanQiaoBei/LanQiao13STEMA202201/5.drawio
Normal file
@@ -0,0 +1 @@
|
||||
<mxfile host="Electron" modified="2022-03-02T00:48:37.103Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.0.2 Chrome/96.0.4664.55 Electron/16.0.5 Safari/537.36" etag="2eQXHvRqI4H5V4rrFl8G" version="16.0.2" type="device"><diagram id="lmY2T2oPIRvynYrYJjzX" name="第 1 页">7Zxdk6I4FIZ/DZdjkW+4bLt7dmurZmp2u2p3+pKStLKD4GC61f31G4agkthKM0rC2FeaAx7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HAqX+oq5fS3NwtxQ1nn1JXP7Wg53f5G+Zm5fS7MQMhQuGWWOaXn5jN3uwqL63Z1e37Z613gl9SF4+eTbLm20LW3QJm0GBl2XDnVHpOelQ9hbpmyJJ9aWJ6v7IoyaXleedEd981Rf3i2eHKi9BG05tLslQi/cdd4SoacPfXN4+Z2Mdse1sC1Pdnc36EW2rjzpjnrnyaww/Vo81duoTwNldacC1bdMdwVKd9Q7UGaZTabgzAuxN2YGWjJfFk2YlqLIv/HbPM3LbdBZnpX5+VOSppopSpNpVhIpiSh3TI/L7DuZROmNOjBP4jh9Lbk/jqz38+m8vh+0vn84kc3rWdf5/lppVuzge1hgSCyHxSz+ofewYGQ7LGYdMfPg+BoHMn1JLDBDw3oNTYuyZFOUE8XdS2imV1HMwR8cEu1yf6x/WzVEkdllXwvs+NcSeP6bQ2u3cpiOSHP297vezBmucL93c/XlLgWOgzUPW9gwH58HGt1R38iYFYql+UyZX3a+1P/72nIZ72LzJTYTfHA90dBnYmL5xhIfesTN1USDYuJWNA49JedqosH8vn4bsrl71Fk1z+yeGIfu/wc=</diagram></mxfile>
|
||||
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/5.jpg
Normal file
BIN
TangDou/LanQiaoBei/LanQiao13STEMA202201/5.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 180 KiB |
45
TangDou/LanQiaoBei/LanQiao13STEMA202201/5_1.cpp
Normal file
45
TangDou/LanQiaoBei/LanQiao13STEMA202201/5_1.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
/**
|
||||
3 0
|
||||
165 175 163
|
||||
155 165 157
|
||||
答案:4
|
||||
*/
|
||||
|
||||
int n, k;
|
||||
|
||||
const int N = 110;
|
||||
int a[N], b[N];
|
||||
int cnt;
|
||||
int st[N];
|
||||
|
||||
void dfs(int u, int s) {
|
||||
if (u == n + 1) {
|
||||
cnt++;
|
||||
return;
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!st[i]) {
|
||||
if (a[u] >= b[i]) {
|
||||
st[i] = 1;
|
||||
dfs(u + 1, s);
|
||||
st[i] = 0;
|
||||
}
|
||||
|
||||
if (a[u] < b[i] && s < k) {
|
||||
st[i] = 1;
|
||||
dfs(u + 1, s + 1);
|
||||
st[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int main() {
|
||||
cin >> n >> k;
|
||||
for (int i = 1; i <= n; i++) cin >> a[i];
|
||||
for (int i = 1; i <= n; i++) cin >> b[i];
|
||||
dfs(1, 0);
|
||||
printf("%d\n", cnt);
|
||||
return 0;
|
||||
}
|
||||
47
TangDou/LanQiaoBei/LanQiao13STEMA202201/5_2.cpp
Normal file
47
TangDou/LanQiaoBei/LanQiao13STEMA202201/5_2.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
/**
|
||||
3 0
|
||||
165 175 163
|
||||
155 165 157
|
||||
答案:4
|
||||
*/
|
||||
|
||||
int n, k;
|
||||
|
||||
const int N = 110;
|
||||
int a[N], b[N];
|
||||
int cnt;
|
||||
int st[N];
|
||||
int s;
|
||||
void dfs(int u) {
|
||||
if (u == n + 1) {
|
||||
cnt++;
|
||||
return;
|
||||
}
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!st[i]) {
|
||||
if (a[u] >= b[i]) {
|
||||
st[i] = 1;
|
||||
dfs(u + 1);
|
||||
st[i] = 0;
|
||||
}
|
||||
|
||||
if (a[u] < b[i] && s < k) {
|
||||
st[i] = 1;
|
||||
s++;
|
||||
dfs(u + 1);
|
||||
s--;
|
||||
st[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int main() {
|
||||
cin >> n >> k;
|
||||
for (int i = 1; i <= n; i++) cin >> a[i];
|
||||
for (int i = 1; i <= n; i++) cin >> b[i];
|
||||
dfs(1);
|
||||
printf("%d\n", cnt);
|
||||
return 0;
|
||||
}
|
||||
25
TangDou/LanQiaoBei/LanQiao13STEMA202201/Test.cpp
Normal file
25
TangDou/LanQiaoBei/LanQiao13STEMA202201/Test.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 10;
|
||||
int a[N];
|
||||
bool st[N];
|
||||
int n = 3;
|
||||
void dfs(int u) {
|
||||
if (u == n + 1) {
|
||||
for (int i = 1; i <= n; i++) cout << a[i] << " ";
|
||||
cout << endl;
|
||||
return;
|
||||
}
|
||||
for (int i = 1; i <= n; i++)
|
||||
if (!st[i]) {
|
||||
a[u] = i;
|
||||
st[i] = true;
|
||||
dfs(u + 1);
|
||||
st[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
dfs(1);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user