From ddce6e2d3e6d83cf1293b186d2cb677f58d6ec8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Tue, 21 May 2024 18:15:47 +0800 Subject: [PATCH] 'commit' --- GESP/2023060401.cpp | 30 ++++++++++++++++++++++++++++ GESP/2023060402_01.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++ GESP/2023060402_2.cpp | 34 +++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 GESP/2023060401.cpp create mode 100644 GESP/2023060402_01.cpp create mode 100644 GESP/2023060402_2.cpp diff --git a/GESP/2023060401.cpp b/GESP/2023060401.cpp new file mode 100644 index 0000000..a053f2b --- /dev/null +++ b/GESP/2023060401.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +const int N = 1010; +int b[N]; // 1、定义桶 +/* +3 3 +0 2 1 +*/ +int main() { + // 2、处理输入输出 + int n, m; + cin >> n >> m; // n:有n个同学,m:报了m次数 + + while (m--) { + int x; + cin >> x; + b[x] = 1; + } + bool flag = false; + for (int i = 0; i < n; i++) + if (!b[i]) { + flag = true; + cout << i << " "; + } + + if (!flag) { + cout << n << endl; + } + return 0; +} \ No newline at end of file diff --git a/GESP/2023060402_01.cpp b/GESP/2023060402_01.cpp new file mode 100644 index 0000000..e4e308f --- /dev/null +++ b/GESP/2023060402_01.cpp @@ -0,0 +1,45 @@ +#include +using namespace std; +void check(string t) { + // 1、必须有大写,小写,数字三种中的两种 + int dx = 0, xx = 0, sz = 0, ts = 0; + // 2、四个特殊字符必须有一个 + // !@#$ + + // 3、不能出现其它字符 + for (int i = 0; i < t.size(); i++) { + if (t[i] >= 'A' && t[i] <= 'Z') + dx = 1; + if (t[i] >= 'a' && t[i] <= 'z') + xx = 1; + if (t[i] == '!' || t[i] == '@' || t[i] == '#' || t[i] == '$') + ts = 1; + if (t[i] >= '0' && t[i] <= '9') + sz = 1; + + if (!(t[i] >= 'A' && t[i] <= 'Z') && !(t[i] >= 'a' && t[i] <= 'z') && !(t[i] >= '0' && t[i] <= '9') && + t[i] != '!' && t[i] != '@' && t[i] != '#' && t[i] != '$') { + return; + } + } + if (dx + xx + sz < 2) return; + if (ts == 0) return; + cout << t << endl; +} +int main() { + string s; + cin >> s; + s += ','; + + string t = ""; + for (int i = 0; i < s.size(); i++) { + if (s[i] == ',') { + check(t); + t = ""; + + } else + t += s[i]; + } + + return 0; +} \ No newline at end of file diff --git a/GESP/2023060402_2.cpp b/GESP/2023060402_2.cpp new file mode 100644 index 0000000..dec5108 --- /dev/null +++ b/GESP/2023060402_2.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; + +set _set = {'!', '@', '#', '$'}; + +void check(string t) { + int dx = 0, xx = 0, sz = 0, ts = 0; + for (int i = 0; i < t.size(); i++) { + if (isupper(t[i])) dx = 1; + if (islower(t[i])) xx = 1; + if (_set.count(t[i])) ts = 1; + if (isdigit(t[i])) sz = 1; + if (!isupper(t[i]) && !islower(t[i]) && !isdigit(t[i]) && !_set.count(t[i])) return; + } + if (dx + xx + sz < 2) return; + if (ts == 0) return; + cout << t << endl; +} +int main() { + string s; + cin >> s; + s += ','; + + string t = ""; + for (int i = 0; i < s.size(); i++) { + if (s[i] == ',') { + check(t); + t = ""; + } else + t += s[i]; + } + + return 0; +} \ No newline at end of file