补全9月11日至13日课评:为13名学生创建请假文档,为5个班级创建总结文档

This commit is contained in:
chengzi
2026-09-13 19:34:34 +08:00
parent 167d832353
commit 21001eccf5
1322 changed files with 37510 additions and 4136 deletions

View File

@@ -0,0 +1,36 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 100010;
int n;
int arr[MAXN];
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> arr[i];
}
if(n == 0){
cout << endl << 0 << endl;
return 0;
}
int j = 1; // 慢指针
for(int i = 2; i <= n; i++){
// i表示快指针,一直向后移动
if(arr[i] == arr[j]) continue;
// 如果不相同
arr[j+1] = arr[i];
j++;
}
for(int i = 1; i <= j; i++){
cout << arr[i] << " ";
}
cout << endl << j;
return 0;
}

View File

@@ -0,0 +1,44 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string s;
int cnt1, cnt2; // cnt1大写 cnt2小写
int main(){
cin >> s;
int len = s.size();
for(int i = 0; i < len; i++){
// 先数小写的个数
if(islower(s[i])){
cnt2++;
}
// 再数大写的个数
if(isupper(s[i])){
cnt1++;
// 转换成小写
s[i] = s[i] + 32;
}
}
int l = 0, r = len - 1;
bool ok = true;
while(l <= r){
if(s[l] != s[r]){
ok = false;
break;
}
l++, r--;
}
if(ok){
cout << "Yes";
} else {
cout << "No";
}
cout << endl << cnt1 << endl << cnt2;
return 0;
}

View File

@@ -0,0 +1,40 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, num, cnt = 0, sum = 0;
string str = "01";
int main() {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> num;
int t = num;
string out = "";
int cnt1 = 0;// 判断1的个数
while(t > 0) {
int g = t % 2;
if(g == 1){
sum++; // 总数加一
cnt1++; // 个数加一
}
out = str[g] + out;
t /= 2;
}
if(cnt1 == 1){
cnt++;
}
}
cout << cnt << endl << sum;
return 0;
}

View File

@@ -0,0 +1,31 @@
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int arr[110] = {0}; // 0表示当前这个同学还在,1表示这个同学出列了
int idx = 1; // 表示当前这个叫到第几个同学
int cnt = 0; // 本轮报数的计数器
int p = n; // 当前人数
while(p != 0){
// 先判断当前这个人是不是出列了
if(arr[idx] == 0){
cnt++;
if(cnt == k){
// 这个人出列
cout << idx << " "; // 当前这个人出列
arr[idx] = 1; // 修改当前这个人出列状态
p--;
cnt = 0;
}
}
idx++;
if(idx > n){
idx = 1;
}
}
return 0;
}

View File

@@ -0,0 +1,37 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int num, k;
string out;
string S = "0123456789ABCDEF";
int cnt1 = 0,cnt2 = 0;
int main(){
cin >> num >> k;
if(num == 0){
cout << 0 << endl << 1 << endl << 0;
return 0;
}
int t = num;
while(t > 0){
int g = t % k;
out = S[g] + out;
t /= k;
}
for(char c : out){
if(isupper(c)){
cnt2++;
}else if(isdigit(c)){
cnt1++;
}
}
cout << out << endl << cnt1 << endl << cnt2;
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,37 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
int arr[100100];
void bubble(int n){
for(int i = 1; i <= n - 1; i++){ // 趟次
bool bol = true; // 认为排好序了
for(int j = 1; j <= n - i; j++){
if(arr[j] > arr[j+1]){
swap(arr[j], arr[j+1]);
bol = false;
}
}
if(bol){
break;
}
}
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> arr[i];
}
bubble(n);
for(int i = 1; i <= n; i++){
cout << arr[i] << " ";
}
return 0;
}

View File

@@ -0,0 +1,38 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
int arr[100100];
void selection(int n) {
for(int i = 1; i <= n; i++) {
int maxx = arr[i]; // 当前这个数是最大的
int idx = i;
for(int j = i + 1; j <= n; j++) {
// 打擂台
if(arr[j] > maxx) {
maxx = arr[j];
idx = j;
}
}
if(arr[i] != maxx) {
swap(arr[i], arr[idx]);
}
}
}
int main() {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> arr[i];
}
selection(n);
for(int i = 1; i <= n; i++) {
cout << arr[i] << " ";
}
return 0;
}

View File

@@ -0,0 +1,36 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, cnt = 0;
int arr[100100];
void insertion(int n){
for(int i = 2; i <= n; i++){ // i前面的都是有序的
int curr = arr[i]; // 当前乱序的第一个
int j = i - 1;
while(j >= 1 && arr[j] > curr){
cnt++;
arr[j+1] = arr[j];
j--;
}
j++;
arr[j] = curr;
}
}
int main() {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> arr[i];
}
insertion(n);
for(int i = 1; i <= n; i++) {
cout << arr[i] << " ";
}
cout << endl << cnt;
return 0;
}

View File

@@ -0,0 +1,35 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, k;
int arr[100100];
void bubble(int n){
for(int i = 1; i <= n - 1; i++){ // 趟次
bool bol = true; // 认为排好序了
for(int j = 1; j <= n - i; j++){
if(arr[j] > arr[j+1]){
swap(arr[j], arr[j+1]);
bol = false;
}
}
if(bol){
break;
}
}
}
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++){
cin >> arr[i];
}
bubble(n);
cout << arr[k];
return 0;
}

View File

@@ -0,0 +1,38 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
string name[100100];
int score[100100];
void bubble(int n){
for(int i = 1; i <= n - 1; i++){ // ÌË´Î
bool bol = true; // ÈÏΪÅźÃÐòÁË
for(int j = 1; j <= n - i; j++){
if(score[j] < score[j+1]){
bol = false;
swap(score[j], score[j+1]);
swap(name[j], name[j+1]);
}
}
if(bol){
break;
}
}
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> name[i] >> score[i];
}
bubble(n);
for(int i = 1; i <= n; i++){
cout << name[i] << " " << score[i] << endl;
}
return 0;
}

Binary file not shown.