黄海 11 months ago
commit ebe26b08c7

@ -1 +1 @@
https://zhuanlan.zhihu.com/p/259191634
https://gitee.com/devcpp/devcpp

Binary file not shown.

Binary file not shown.

@ -0,0 +1,10 @@
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
int a, b, c;
int x;
cin >> a >> b >> c;
return 0;
}

@ -0,0 +1,47 @@
#include <bits/stdc++.h>
using namespace std;
bool issimilar(string a, string b) {
if (abs((int)a.size() - (int)b.size()) > 1)
return false;
if (a.size() == b.size()) {
int cnt = 0;
for (int i = 0; i < a.size(); i++) {
if (a[i] != b[i])
if (cnt++ > 1)
return false;
}
return true;
} else {
int cnt = 0;
if (a.size() > b.size())
swap(a, b);
int j = 0;
for (int i = 0; i < a.size();) {
if (a[i] != b[j]) {
cnt++;
j++;
} else {
i++;
j++;
}
}
if (cnt > 1)
return false;
return true;
}
}
int main() {
int T;
cin >> T;
while (T--) {
string a, b;
cin >> a >> b;
if (issimilar(a, b)) {
cout << "similar" << endl;
} else
cout << "not similar" << endl;
}
return 0;
}

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;//题单数量上限
int a[N];//每套题单里面的题的数量
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + 1 + n);
int h = 1;//排完序后,待比较的题单号
for (int i = 1;;) { //枚举每一天依赖break停止
if (a[h] >= i) //允许,可以走到一天
i++;
if (++h > n) {
cout << i - 1 << endl;
break;
}
}
return 0;
}

@ -0,0 +1,114 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 256;
int b[N];
int toDec(char a, char b) {
int res = 0;
if (a >= 'A' && a <= 'F')
res += (a + 10 - 'A') * 16;
else
res += (a - '0') * 16;
if (b >= 'A' && b <= 'F')
res += b + 10 - 'A';
else
res += b - '0';
return res;
}
string toHex(int x) {
int a = x % 16;
int b = x / 16;
char c1, c2;
if (a >= 10)
c1 = 'A' + a - 10;
else
c1 = a + '0';
if (b >= 10)
c2 = 'A' + b - 10;
else
c2 = b + '0';
string res;
res.push_back(c2);
res.push_back(c1);
return res;
}
vector<string>q;
//struct Node {
// int id;
// int cnt;
// const bool operator<(const Node &b)const {
// if (cnt == b.cnt)
// return id < b.id;
// return cnt > b.cnt;
// }
//};
//Node迟到了让副评审来吧
vector<int>vec;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
q.push_back(s);
for (int j = 0; j < s.size(); j += 2) {
char c1, c2;
c1 = s[j], c2 = s[j + 1];
int k = toDec(c1, c2);
b[k]++;
}
}
// 选举开始~~~
// 现在向我们走来的是很多个由256也可能更少个种类的选手
// 我们要选出其中最多的16个种族
//裁判是vec<node>
// vec<node>不在时裁判就是用两个for1个mx集团
//包括mx最大值mx_id最大值的编号
//和一个vec<int>!
//开始吧!
// for (int i = 0; i <= 255; i++)
// if (b[i])
// vec.push_back({i, b[i]});
//为了防止有色块冒充,先筛一遍,然后录入选手名单!
// sort(vec.begin(), vec.end());
//由大到小排序!
// 我们输出前十六个!
for (int i = 0; i < 16; i++) {
int mx, mx_id;
mx = 0, mx_id = -1;
for (int j = 0; j < 256; j++)
if (b[j] > mx) {
mx = b[j];
mx_id = j;
}
vec.push_back(mx_id);
//important!!!
b[mx_id] = -1;
//用完要标明~不能再用了
}
for (int i = 1; i <= 16; i++)
cout << toHex(vec[i]);
cout << endl;
//开启第二问~
for (int i = 0; i < n; i++) {
for (int j = 0; j < q[0].size(); j += 2) {
char c1, c2;
c1 = q[i][j], c2 = q[i][j + 1];
int x = toDec(c1, c2);
int mi = INT_MAX;
int mi_p = 0;
for (int k = 0; k < 16; k++) {
if (mi > abs(vec[k] - x)) {
mi = abs(vec[k] - x);
mi_p = k;
}
}
cout << toHex(mi_p)[1];
}
cout << endl;
}
return 0;
}

@ -0,0 +1,87 @@
#include <bits/stdc++.h>
using namespace std;
const int N = 256;
int b[N];
int toDec(char a, char b) {
int res = 0;
if (a >= 'A' && a <= 'F')
res += (a - 'A' + 10) * 16;
else
res += (a - '0') * 16;
if (b >= 'A' && b <= 'F')
res += b - 'A' + 10;
else
res += b - '0' ;
return res;
}
string toHex(int x) {
int a = x % 16;
int b = x / 16;
char c1, c2;
if (a >= 10)
c1 = 'A' + a - 10;
else
c1 = a + '0';
if (b >= 10)
c2 = 'A' + b - 10;
else
c2 = b + '0';
string res;
res.push_back(c2);
res.push_back(c1);
return res;
}
vector<string>q;
vector<int>vec;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
q.push_back(s);
for (int j = 0; j < s.size(); j += 2) {
char c1 = s[j], c2 = s[j + 1];
int k = toDec(c1, c2);
b[k]++;
}
}
for (int i = 0; i < 16; i++) {
int mx = 0, mx_id = -1;
for (int j = 0; j < 256; j++)
if (b[j] > mx) {
mx = b[j];
mx_id = j;
}
vec.push_back(mx_id);
b[mx_id] = -1;
}
for (int i = 0; i < min(16, (int)vec.size()); i++)
cout << toHex(vec[i]) ;
cout << endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < q[0].size(); j += 2) {
int c1 = q[i][j], c2 = q[i][j + 1];
int x = toDec(c1, c2);
int mi = INT_MAX;
int mi_p = 0;
for (int k = 0; k < min(16, (int)vec.size()); k++) {
if (mi > abs(vec[k] - x)) {
mi = abs(vec[k] - x);
mi_p = k;
}
}
cout << toHex(mi_p)[1];
}
cout << endl;
}
return 0;
}

@ -0,0 +1,102 @@
#include <bits/stdc++.h>
using namespace std;
//将一个16进制的灰阶转为一个整数方便用来当数组的下标索引值
int toDec(char a, char b) {
int res = 0;
if (a >= '0' && a <= '9')
res += (a - '0') * 16;
else if (a >= 'A' && a <= 'F')
res += (a - 'A' + 10) * 16;
if (b >= '0' && b <= '9')
res += b - '0';
else if (b >= 'A' && b <= 'F')
res += b - 'A' + 10;
return res;
}
//将一个十进制的灰阶值[0,255]转化成十六进制[0,FF]
string toHex(int x) {
char c1, c2;
int a = x % 16; // 0 ~ 15
int b = x / 16; //
if (a >= 10)
c1 = 'A' + a - 10;
else
c1 = '0' + a;
if (b >= 10)
c2 = 'A' + b - 10;
else
c2 = '0' + b;
string res;
res.push_back(c2);
res.push_back(c1);
return res;
}
const int N = 256;
//桶
int bucket[N];//0 ~ 255
//原始的字符串数组
string q[30];
//结构体,用来把桶中的灰阶按数量排序用的
struct Node {
int id;//数组下标
int cnt;//个数
const bool operator<(const Node &b) const {
if (cnt == b.cnt)
return id < b.id;
return cnt > b.cnt;
}
};
vector<Node> vec;//需要把bucket组装成Node放到数组p中才能使用结构体排序吧
int main() {
freopen("D://HuiJie.txt", "r", stdin);
int n;
cin >> n;//有n行数据组成了图像
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
q[i] = s;//存入原始字符串数组
for (int j = 0; j < s.size(); j += 2) {
char a = s[j], b = s[j + 1];
int k = toDec(a, b); //灰阶对应的数组位置
bucket[k]++;
}
}
for (int i = 0; i <= 255; i++)
vec.push_back({i, bucket[i]});
sort(vec.begin(), vec.end());
//前十六位字符打印出来
for (int i = 0; i < min(16, (int)vec.size()); i++)
cout << toHex(vec[i].id) ;
cout << endl;
//第二问的回答
for (int i = 1; i <= n; i++) { //枚举每个原始字符串每2个一组判断这个小串应该与尺子数组中的哪一个更接近
for (int j = 0; j < q[1].size(); j += 2) {
char a = q[i][j], b = q[i][j + 1]; //0 F ,0 F
int x = toDec(a, b);
int mi = INT_MAX;
int mi_p = 0;
for (int k = 0; k < min(16, (int)vec.size()); k++) { //16是有风险的因为可能没有16个那么多
if (mi > abs(vec[k].id - x)) {
mi = abs(vec[k].id - x);
mi_p = k;
}
}
cout << toHex(mi_p)[1];
}
cout << endl;
}
return 0;
}

@ -0,0 +1,17 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
ofstream fout;
fout.open("1.txt");
for (int i = 1; i <= 10; i++) {
if (i % 5 == 0) {
int x = 6;
fout << x;
} else {
char ch = 'A';
fout << ch;
}
}
return 0;
}

@ -0,0 +1,5 @@
【吐血整理】99.5%充电桩设备接入的终极指南 云快充协议——慧哥慧知充电桩开源系统V2.5.5
https://blog.csdn.net/Roinli/article/details/138178245
慧哥充电桩开源平台V2.5.2 【汽车 电动自行车 云快充1.5、云快充1.6、SpringCloud、MySQL、uniapp、redis】
https://liwenhui.blog.csdn.net/article/details/134773779?spm=1001.2014.3001.5502

Binary file not shown.
Loading…
Cancel
Save