main
黄海 1 year ago
parent 10638f3113
commit ddce6e2d3e

@ -0,0 +1,30 @@
#include <bits/stdc++.h>
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;
}

@ -0,0 +1,45 @@
#include <bits/stdc++.h>
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;
}

@ -0,0 +1,34 @@
#include <bits/stdc++.h>
using namespace std;
set<char> _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;
}
Loading…
Cancel
Save