课评: 转出学生归档(王子墨/张立坤/黄俊博)+ 周四班级总结 + 新生章梓皓档案 + C++示例代码

This commit is contained in:
chengzi
2026-09-29 22:43:54 +08:00
parent 6f57dfe67e
commit 73cce4c4f5
116 changed files with 6817 additions and 248 deletions

View File

@@ -0,0 +1,53 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, num;
int s[100];
string str = "01";
// 10进制转换成 2进制
string f(int n){
if(n == 0) return "0";
string re = "";
while(n > 0){
int g = n % 2;
re = str[g] + re;
n /= 2;
}
return re;
}
int main(){
cin >> n;
int maxx = 0;
for(int i = 1; i <= n; i++){
cin >> num;
string curr = f(num);
int len = curr.size();
int idx = 0;
for(int j = len - 1; j >= 0; j--){
char c = curr[j];
if(c == '1'){
s[idx]++;
}
idx++;
}
maxx = max(maxx, idx); // 统计最长字符串
// cout << "当前这个数二进制是" << curr << " " << idx << endl;
}
int cnt = 0;
for(int i = 0; i < maxx; i++){
if(s[i] == n) {
cnt++;
}
}
cout << cnt;
return 0;
}

View File

@@ -0,0 +1,46 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string s;
int main(){
getline(cin, s);
int len = s.size();
string curr = ""; // 当前这个字符串
int k = 1; // 需要多少个空格
int idx = 0; // 当前的下标
while(idx < len){
char c = s[idx];
if(c == ' '){
// 当遇到空格
string z = s.substr(idx, k);
bool ok = true;
for(char c1 : z){
if(c1 != ' ') {
ok = false;
break;
}
}
if(ok){
cout << curr << endl;
idx += k;
k++; // 下一次的空格要加一
curr = "";
continue;
}
}
curr += c;
if(idx == len - 1){
cout << curr << endl;
}
idx++;
}
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,36 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string s;
int main() {
getline(cin, s);
int len = s.size();
string curr = ""; // 要输出的这个字符串
int kg = 1; // 中断的空格数量
int cnt = 0; // 当前空格的数量
for(char c : s) {
curr += c;
if(c == ' ') {
cnt++;
} else {
cnt = 0;
}
if(cnt == kg) {
cout << curr << endl;
cnt = 0;
kg++;
curr = "";
}
}
if(curr.size() >= 1) {
cout << curr << endl;
}
return 0;
}

View File

@@ -0,0 +1,30 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string s;
int main(){
getline(cin, s);
string kg = "";
int l = 0, r = 0;
while(true){
kg = kg + ' ';
if(s.find(kg, l) == string::npos){
// 如果没有找到
r = s.size() - 1;
cout << s.substr(l, r - l) << endl;
break;
} else {
// 找到了
r = s.find(kg, l);
cout << s.substr(l, r - l) << endl;
l = r + kg.size();
}
}
return 0;
}