Compare commits
50 Commits
ae5923de5b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2395b6669b | |||
| b9bf94fc0b | |||
| 4e6373ac46 | |||
| 1859a0eb18 | |||
| 23adf96c96 | |||
| 749863ceea | |||
| eb54cfd79c | |||
| 6405b2ae00 | |||
| 075ee7b8ef | |||
| dcc1785876 | |||
| cdbdb19bcc | |||
| 368a2f38de | |||
| 2dd6a3164b | |||
| 8947405052 | |||
| ecced5ef72 | |||
| 041c38fdb7 | |||
| bfa768a6b6 | |||
| 852d080561 | |||
| 7ac7453834 | |||
| 3ebb41efd0 | |||
| 80feb55839 | |||
| 5ca6fd14fe | |||
| a04f8f6b61 | |||
| bbac2c9d86 | |||
| 6a40c32b12 | |||
| adacdb714c | |||
| d289098e07 | |||
| 33a47356c9 | |||
| 13323636d5 | |||
| 0c15876743 | |||
| db633183e2 | |||
| 85c8c86d50 | |||
| d4b752fded | |||
| cf117ec47b | |||
| d593e0972e | |||
| c0b8699c35 | |||
| b1c192e03b | |||
| b5471b769d | |||
| 67b1d745b6 | |||
| 73a50c0303 | |||
| 2f8d74a33d | |||
| 33a316f373 | |||
| 4f399c8649 | |||
| a871350cc2 | |||
| 56f84919a0 | |||
| d6575769a8 | |||
| 4f53f6c91b | |||
| f66c63aab8 | |||
| 759fc4c403 | |||
| 4b325cdd31 |
2
.obsidian/app.json
vendored
2
.obsidian/app.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"livePreview": true,
|
||||
"defaultViewMode": "preview",
|
||||
"showLineNumber": false,
|
||||
"showLineNumber": true,
|
||||
"promptDelete": false,
|
||||
"newFileLocation": "folder",
|
||||
"attachmentFolderPath": "YueQian/assets/相关网站",
|
||||
|
||||
105
.obsidian/workspace.json
vendored
105
.obsidian/workspace.json
vendored
@@ -8,14 +8,14 @@
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "e8387cb6b409e6ef",
|
||||
"id": "16bf7c9043fb99ee",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "YueQian/相关网站.md",
|
||||
"mode": "source",
|
||||
"source": false,
|
||||
"mode": "preview",
|
||||
"source": true,
|
||||
"backlinks": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
@@ -23,20 +23,37 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "2f54407cf310a486",
|
||||
"id": "a699df623da488e3",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "webviewer",
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"url": "https://music.zbright.top/",
|
||||
"title": "道理鱼音乐管理",
|
||||
"mode": "webview"
|
||||
"file": "Collection/连~都忘记了的小知识.md",
|
||||
"mode": "source",
|
||||
"source": false,
|
||||
"backlinks": false
|
||||
},
|
||||
"icon": "globe-2",
|
||||
"title": "道理鱼音乐管理"
|
||||
"icon": "lucide-file",
|
||||
"title": "连~都忘记了的小知识"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bb684fcfc9ac7ba6",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Diary/2026-2/2026-2-3 周二.md",
|
||||
"mode": "source",
|
||||
"source": false,
|
||||
"backlinks": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "2026-2-3 周二"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"currentTab": 2
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
@@ -103,13 +120,13 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "YueQian/相关网站.md",
|
||||
"file": "Diary/2026-2/2026-2-3 周二.md",
|
||||
"followCursor": true,
|
||||
"showSearch": false,
|
||||
"searchQuery": ""
|
||||
},
|
||||
"icon": "lucide-list",
|
||||
"title": "相关网站 的大纲"
|
||||
"title": "2026-2-3 周二 的大纲"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -260,43 +277,46 @@
|
||||
"remotely-save:Remotely Save": false
|
||||
}
|
||||
},
|
||||
"active": "e8387cb6b409e6ef",
|
||||
"active": "bb684fcfc9ac7ba6",
|
||||
"lastOpenFiles": [
|
||||
"YueQian/相关网站.md",
|
||||
"YueQian/Homework/~WRL1582.tmp",
|
||||
"YueQian/Homework/~WRD1582.tmp",
|
||||
"YueQian/Homework/~WRL3055.tmp",
|
||||
"YueQian/Homework/~WRD3051.tmp",
|
||||
"YueQian/Homework/~$28数组测试题.docx",
|
||||
"YueQian/Homework/1-28数组测试题.docx",
|
||||
"Diary/2026-1/2026-1-28 周三.md",
|
||||
"Collection/连~都忘记了的小知识.md",
|
||||
"Excalidraw/Drawing 20260122.md",
|
||||
"Diary/2026-2/2026-2-3 周二.md",
|
||||
"YueQian/Homework/~$2.3作业.docx",
|
||||
"YueQian/Homework/2.3作业.docx",
|
||||
"YueQian/Homework/d94bc2621da31bd2a2cdb32f2900b975.par.temp",
|
||||
"Collection/KMP算法.md",
|
||||
"Diary/2026-1/2026-1-27 周二.md",
|
||||
"Diary/2026-1/2026-1-26 周一.md",
|
||||
"YueQian/Homework/~$27函数作业题.docx",
|
||||
"YueQian/Homework/~WRL0001.tmp",
|
||||
"YueQian/Homework/~WRD0000.tmp",
|
||||
"YueQian/Homework/~$27函数练习题.docx",
|
||||
"Diary/2026-1/2026-1-25 周日.md",
|
||||
"BlogWebsite/Article/MarkdownTest.md",
|
||||
"Collection/Obsidian使用飞牛WebDAV实现多端同步.md",
|
||||
"Collection/配置备忘/navidrome.md",
|
||||
"Diary/2026-1/2026-1-24 周六.md",
|
||||
"Collection/配置备忘/Typecho插件Aplayer使用教程.md",
|
||||
"School/安装AD2025学习版.md",
|
||||
"YueQian/Homework/~WRL0004.tmp",
|
||||
"BlogWebsite/Article/Obsidian使用飞牛WebDAV实现多端同步.md",
|
||||
"YueQian/Homework/~$2数组与指针作业.doc",
|
||||
"Diary/2026-2/2026-2-2 周一.md",
|
||||
"YueQian/Homework/2-2数组与指针作业.doc",
|
||||
"YueQian/Homework/~$30指针与数组作业.doc",
|
||||
"Collection/YoudaoyunNotes/01Linux基础/01-开发环境安装.md",
|
||||
"Collection/YoudaoyunNotes/01Linux基础/00-简介.md",
|
||||
"YueQian/Homework/~$指针.docx",
|
||||
"Diary/2026-2/2026-2-1 周日.md",
|
||||
"Diary/2026-2",
|
||||
"YueQian/Homework/~WRL3723.tmp",
|
||||
"Diary/2026-1/2026-1-23 周五.md",
|
||||
"YueQian/Homework/1-23-5题存疑.md",
|
||||
"Collection/YoudaoyunNotes/01Linux基础/02_Linux概述.md",
|
||||
"Diary/2026-1/2026-1-22 周四.md",
|
||||
"Diary/2026-1/2026-1-21 周三.md",
|
||||
"Diary/2026-1/2026-1-20 周二.md",
|
||||
"Diary/2026-1/2026-1-19 周一.md",
|
||||
"Collection/PID控制算法.md",
|
||||
"Collection/linux命令.md",
|
||||
"README.md",
|
||||
"test.md",
|
||||
"Diary/2026-1/2026-1-31 周六.md",
|
||||
"Diary/2026-1/2026-1-30 周五.md",
|
||||
"YueQian/Homework/1-29作业.md",
|
||||
"YueQian/Homework/1.19-已完成.md",
|
||||
"YueQian/Homework/1-29.md",
|
||||
"YueQian/Homework/assets/1-29/file-20260129210143912.png",
|
||||
"YueQian/Homework/assets/1-29/file-20260129202925505.png",
|
||||
"YueQian/Homework/assets/1-29/file-20260129201415992.png",
|
||||
"Diary/2026-1/2026-1-29 周四.md",
|
||||
"Diary/2026-1/2026-1-28 周三.md",
|
||||
"Excalidraw/Drawing 20260122.md",
|
||||
"Diary/2026-1/2026-1-27 周二.md",
|
||||
"Diary/2026-1/2026-1-26 周一.md",
|
||||
"Diary/2026-1/2026-1-25 周日.md",
|
||||
"Excalidraw/Untitled.canvas",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore10.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore07.png",
|
||||
@@ -305,9 +325,6 @@
|
||||
"Article/Studyroad/vivado_ip_img/IPCore15.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore02.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore03.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore17.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore04.png",
|
||||
"Article/Studyroad/vivado_ip_img/IPCore14.png",
|
||||
"YueQian/Homework/未命名.canvas",
|
||||
"Excalidraw/未命名.canvas",
|
||||
"未命名.canvas"
|
||||
|
||||
40
BlogWebsite/Article/Obsidian使用飞牛WebDAV实现多端同步.md
Normal file
40
BlogWebsite/Article/Obsidian使用飞牛WebDAV实现多端同步.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
tags:
|
||||
- "#飞牛"
|
||||
- Webdav
|
||||
- obsidian
|
||||
- 同步
|
||||
aliases: empty
|
||||
日期: 2026/1/24
|
||||
---
|
||||
# Obsidian使用飞牛WebDAV实现多端同步
|
||||
## 前言
|
||||
由于最近博主的人生阶段在向前迈进,就有了对笔记和清单的需求,也是入坑了滴答清单和obsidian,既然滴答清单能够做到多端同步,那么obsidian不实现的话就会有一种很不舒服的感觉。就想着写一写记录一下实现过程,防止我自己后面不知道怎么弄了,也想着给看到这篇文章的朋友们一些参考~~(微乎其微)~~。
|
||||
## 条件需求
|
||||
- WebDAV服务端
|
||||
- Obsidian Remotely-Save插件(多端)
|
||||
- Android端 MT文件管理器
|
||||
## 正式开始
|
||||
### 飞牛端操作
|
||||
#### 创建文件夹
|
||||
打开文件管理->我的文件,在自己喜欢的位置创建对应文件夹用于WebDAV服务 。
|
||||
#### 开启WebDAV服务
|
||||
打开系统设置->文件共享协议->WebDAV,开启WebDAV服务并设置可见文件夹范围。
|
||||
#### 开启通过FN Connect远程访问WebDAV服务
|
||||
打开系统设置->远程访问->FN Connect,FN ID下面有一个高级设置选项,点击后开启允许通过 FN connect远程访问WebDAV服务,开启后关闭弹窗,滑动到最底部复制WebDAV远程访问链接。
|
||||
### PC端操作
|
||||
#### 安装Remotely Save插件
|
||||
可以在Obsidian第三方插件市场直接安装,也可以去[GitHub仓库](https://github.com/remotely-save/remotely-save "remotely-save插件GitHub仓库")下载安装;如果是“标准国内网络”(Obsidian第三方插件市场和GitHub都打不开),可以去[PKMer_Obsidian 插件集市](https://pkmer.cn/products/plugin/pluginMarket/)里下载。
|
||||
#### 配置Remotely-Save插件
|
||||
这个插件的配置非常简单,首先选择**WebDAV**远程服务,然后填入WebDAV服务器地址,这里飞牛用户有一个小坑,如果你的飞牛文件共享协议中WebDAV可见文件夹范围不止一项(我的文件可见、团队文件也可见 等),那么直接使用飞牛dav域名时链接后面需要跟上某一具体文件夹路径,如我有我的文件和团队文件两项在WebDAV中可见,在我的文件下有一个名为fileserver的文件夹,我要在这个文件夹下保存我的obsidian仓库,我的**链接写为**<https://dav.yourfnID.fnos.net/fileserver>,然后**填入WebDAV用户名和密码**,这里就是飞牛账号的账号密码。默认会以你的obsidian仓库名作为WebDAV服务器上的文件夹名,其他设置不用修改,点击检查可以检查配置是否正常。正常后,后续设置建议**打开启动后运行一次**可以保证在其它端设备修改保存并同步后在PC端使用时能够及时拉取,定时同步功能看自己需求。
|
||||
### Android端操作
|
||||
#### 创建仓库
|
||||
初始化obsidian,就使用obsidian文件夹作为仓库,这里不使用其它路径的原因是手机会自动将obsidian仓库里面的图片添加到相册和文件管理中,导致相册杂乱,使用obsidian软件目录有一个缺点,当你卸载软件后obsidian软件目录会一并清空(创建仓库时obsidian会有提示),所以需要卸载前备份,我们这里用作同步WebDAV服务器中本就有备份,只要及时同步,就算卸载掉obsidian后软件目录被清空,也是能从WebDAV服务器里找回的(配置文件不同步故而无法找回)。
|
||||
#### 导入其它端仓库
|
||||
这里有两种方法,**一是**将其他地方的仓库(包括.obsidian配置文件夹)复制到手机中,然后使用MT文件管理器进行替换,适用于手机端因某些原因无法安装插件和不想一个一个重新安装插件的情况;**二是**手机端初始化好仓库以后,安装并配置Remotely-Save插件,然后通过WebDAV直接同步其它端的仓库下来,适用于仓库不大且不想在手机端安装太多插件的情况。
|
||||
**文件替换方式**
|
||||
首先将其它端的仓库弄到手机你知道的文件夹中,然后打开MT文件管理器,两边分别进入obsidian软件文件夹和有其它端仓库的文件夹,obsidian软件文件夹完整路径在我这里是`/storage/emulated/0/Android/data/md.obsidian`,然后按住其它端仓库的文件夹,在弹出菜单中选择移动或替换即可(注意对应路径)。替换成功后在电脑端的各个软件配置大部分都是还在的,直接点击同步应该可以同步成功。
|
||||
**WebDAV同步方式**
|
||||
打开obsidian的第三方插件库,搜索Remotely-Save安装并启用,配置Remotely-Save让其与其它端一致,点击检查,能够连接成功即表示配置没有问题。不过其他配置和插件还需要人为调整和安装。*不建议开启Remotelty-Save的同步配置文件(.obsidian文件夹)功能,可能导致不同端不同的配置出现混乱*
|
||||
## 参考文章
|
||||
***自己摸索***
|
||||
@@ -23,27 +23,18 @@ KMP算法的时间复杂度为O(n+m),其中n是主串的长度,m是模式串
|
||||
```c
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// 函数原型声明
|
||||
|
||||
void computeLPSArray(char *pat, int M, int *lps);
|
||||
|
||||
void KMPSearch(char *pat, char *txt);
|
||||
|
||||
int main() {
|
||||
|
||||
char text[] = "ABABDABACDABABCABAB";
|
||||
|
||||
char pattern[] = "ABABCABAB";
|
||||
|
||||
printf("Text: %s\n", text);
|
||||
|
||||
printf("Pattern: %s\n", pattern);
|
||||
|
||||
KMPSearch(pattern, text);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -60,25 +51,27 @@ int i = 1;
|
||||
|
||||
while (i < M) {
|
||||
|
||||
if (pat[i] == pat[len]) {
|
||||
if (pat[i] == pat[len]) {
|
||||
|
||||
len++;
|
||||
len++;
|
||||
|
||||
lps[i] = len;
|
||||
lps[i] = len;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
if (len != 0) {
|
||||
if (len != 0) {
|
||||
|
||||
len = lps[len - 1];
|
||||
len = lps[len - 1];
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
lps[i] = 0;
|
||||
lps[i] = 0;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
@@ -117,25 +110,16 @@ i++;
|
||||
}
|
||||
|
||||
if (j == M) {
|
||||
|
||||
printf("Pattern found at index %d \n", i - j);
|
||||
|
||||
j = lps[j - 1];
|
||||
|
||||
} else if (i < N && pat[j] != txt[i]) {
|
||||
|
||||
if (j != 0)
|
||||
|
||||
j = lps[j - 1];
|
||||
|
||||
printf("Pattern found at index %d \n", i - j);
|
||||
j = lps[j - 1];
|
||||
}
|
||||
else if (i < N && pat[j] != txt[i]) {
|
||||
if (j != 0)
|
||||
j = lps[j - 1];
|
||||
else
|
||||
|
||||
i = i + 1;
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
tags:
|
||||
- "#飞牛"
|
||||
- Webdav
|
||||
- obsidian
|
||||
- 同步
|
||||
aliases: empty
|
||||
日期: 2026/1/24
|
||||
---
|
||||
# Obsidian使用飞牛WebDAV实现多端同步
|
||||
## 前言
|
||||
由于最近博主的人生阶段在向前迈进,就有了对笔记和清单的需求,也是入坑了滴答清单和obsidian,既然滴答清单能够做到多端同步,那么obsidian不实现的话就会有一种很不舒服的感觉。就想着写一写记录一下实现过程,防止我自己后面不知道怎么弄了,也想着给看到这篇文章的朋友们一些参考~~(微乎其微)~~。
|
||||
## 条件需求
|
||||
- WebDAV服务端
|
||||
- Obsidian Remotely-Save插件(多端)
|
||||
- Android端 MT文件管理器
|
||||
## 正式开始
|
||||
### PC端操作
|
||||
#### 安装Remotely Save插件
|
||||
可以在Obsidian第三方插件市场直接安装,也可以去[GitHub仓库](https://github.com/remotely-save/remotely-save "remotely-save插件GitHub仓库")下载安装;如果是“标准国内网络”(Obsidian第三方插件市场和GitHub都打不开),可以去[PKMer_Obsidian 插件集市](https://pkmer.cn/products/plugin/pluginMarket/)里下载。
|
||||
#### 配置Remotely-Save插件
|
||||
这个插件的配置非常简单,首先选择**WebDAV**远程服务,然后填入WebDAV服务器地址,这里飞牛用户有一个小坑,如果你的飞牛文件共享协议中WebDAV可见文件夹范围不止一项(我的文件可见、团队文件也可见 等),那么直接使用飞牛dav域名时链接后面需要跟上某一具体文件夹路径,如我有我的文件和团队文件两项在WebDAV中可见,在我的文件下有一个名为fileserver的文件夹,我要在这个文件夹下保存我的obsidian仓库,我的**链接写为**`https://dav.yournID.fnos.net/fileserver`,然后**填入WebDAV用户名和密码**,这里就是飞牛账号的账号密码。默认会以你的obsidian仓库名作为WebDAV服务器上的文件夹名,其他设置不用修改,点击检查可以检查配置是否正常。正常后,后续设置建议**打开启动后运行一次**可以保证在其它端设备修改保存并同步后在PC端使用时能够及时拉取,定时同步功能看自己需求。
|
||||
@@ -41,4 +41,5 @@ switch (num)
|
||||
break;
|
||||
}
|
||||
```
|
||||
- 函数的名称与数组的名称一样,是函数的首地址
|
||||
- 函数的名称与数组的名称一样,是函数的首地址
|
||||
- `a[i][j] ≡ *(*(a+i)+j) ≡ *(a[i]+j) ≡ (*(a+i))[j]`
|
||||
Binary file not shown.
206
YueQian/Homework/1-29作业.md
Normal file
206
YueQian/Homework/1-29作业.md
Normal file
@@ -0,0 +1,206 @@
|
||||
---
|
||||
tags:
|
||||
- 作业
|
||||
- C语言
|
||||
aliases: empty
|
||||
日期: 2026/1/29
|
||||
---
|
||||
**1.定义一个长度为10的数组并从键盘输入10个整数对数组进行赋值,并实现下列功能**
|
||||
|
||||
1. 判定该数组是否有序
|
||||
|
||||
2. 若无序则将数组中的数据进行排序
|
||||
|
||||
3. 找出数组中是否存在众数并输出结果
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
void bubble_sort(int arr[],int lenth)
|
||||
{
|
||||
for(int i = 0;i < lenth;i++){
|
||||
for(int j = i+1;j < lenth;j++){
|
||||
if(arr[i] > arr[j]){
|
||||
arr[i] ^= arr[j];
|
||||
arr[j] ^= arr[i];
|
||||
arr[i] ^= arr[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sort_check(int arr[],int lenth)
|
||||
{
|
||||
int count = 0,fcount=0;
|
||||
for(int i=0,j=1;i<lenth-1;i++,j++){
|
||||
if(arr[i] >= arr[j])
|
||||
count++;
|
||||
if(arr[i] <= arr[j])
|
||||
fcount++;
|
||||
}
|
||||
if(count == lenth-1 || fcount == lenth-1)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void find_mode(int arr[], int length)
|
||||
{
|
||||
int count[10] = {0};
|
||||
int max_freq = 1;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (count[i] != -1) {
|
||||
int freq = 1;
|
||||
for (int j = i + 1; j < length; j++) {
|
||||
if (arr[i] == arr[j]) {
|
||||
freq++;
|
||||
count[j] = -1;
|
||||
}
|
||||
}
|
||||
count[i] = freq;
|
||||
if (freq > max_freq) {
|
||||
max_freq = freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("数组众数结果:");
|
||||
int has_mode = 0;
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (count[i] == max_freq) {
|
||||
if (has_mode) printf("、");
|
||||
printf("%d(出现%d次)", arr[i], max_freq);
|
||||
has_mode = 1;
|
||||
}
|
||||
}
|
||||
if (max_freq == 1) {
|
||||
printf("所有元素均仅出现1次,无有效众数\n");
|
||||
} else {
|
||||
printf("(最大频次:%d)\n", max_freq);
|
||||
}
|
||||
}
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
int arr[10];
|
||||
int mode;
|
||||
printf("输入10个数:");
|
||||
for(int i=0;i<10;i++)
|
||||
scanf("%d",&arr[i]);
|
||||
if(sort_check(arr,10))
|
||||
printf("已排序\n");
|
||||
else{
|
||||
printf("未排序\n");
|
||||
bubble_sort(arr,10);
|
||||
printf("排序后为:");
|
||||
for(int i=0;i<10;i++)
|
||||
printf("%d ",arr[i]);
|
||||
printf("\n");
|
||||
}
|
||||
find_mode(arr,10);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||

|
||||
**2.定义一个二维数组存储一个3x3的矩阵,实现如下功能**
|
||||
|
||||
1. 计算矩阵对角元素的和
|
||||
2. 判断矩阵是否是对称矩阵
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
#define ROW 3
|
||||
#define COL 3
|
||||
|
||||
int calcDiagSum(int matrix[ROW][COL])
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < ROW; i++) {
|
||||
sum += matrix[i][i];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
int isSymmetricMatrix(int matrix[ROW][COL])
|
||||
{
|
||||
for (int i = 0; i < ROW; i++) {
|
||||
for (int j = 0; j < COL; j++) {
|
||||
if (matrix[i][j] != matrix[j][i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
int matrix[ROW][COL];
|
||||
printf("请输入3x3矩阵的9个整数:\n");
|
||||
for (int i = 0; i < ROW; i++) {
|
||||
for (int j = 0; j < COL; j++) {
|
||||
scanf("%d", &matrix[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
int diagSum = calcDiagSum(matrix);
|
||||
printf("\n矩阵主对角线元素的和为:%d\n", diagSum);
|
||||
if (isSymmetricMatrix(matrix))
|
||||
printf("该3x3矩阵是对称矩阵\n");
|
||||
else
|
||||
printf("该3x3矩阵不是对称矩阵\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||

|
||||
**3.小张作为公司的HR设计了一个年会游戏,来观察员工的团队协作能力、测试员工在压力下的决策能力,寻找潜在的项目领导者,现在有N名员工参与并围坐一圈,游戏规则如下:**
|
||||
- 从某位员工开始顺时针报数
|
||||
- 报到数字M的倍数员工被淘汰出局
|
||||
- 从下一位员工继续报数,重复步骤2
|
||||
- 游戏继续直到只剩下K名员工(获胜者)
|
||||
*小刘作为公司的技术骨干编写了一个程序,帮助他每次都能处在胜利者中并最终获得晋升资格,请你使用C语言编程复现小刘的程序实现以下功能:*
|
||||
- 输入总人数N、报数间隔M和获胜人数K
|
||||
- 计算并输出安全的座位位置(最后剩下的K人)
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
int N,M,K;
|
||||
printf("请输入参与总人数:");
|
||||
scanf("%d",&N);
|
||||
printf("请输入报数间隔:");
|
||||
scanf("%d",&M);
|
||||
printf("请输入获胜人数:");
|
||||
scanf("%d",&K);
|
||||
|
||||
int isEliminated[N+1];
|
||||
int eliminateCount = 0;
|
||||
int currentPos = 0;
|
||||
int countNum = 0;
|
||||
|
||||
for(int i=0;i<=N+1;i++)
|
||||
isEliminated[i] = 0;
|
||||
|
||||
while (eliminateCount < N - K) {
|
||||
currentPos = (currentPos % N) + 1;
|
||||
if (!isEliminated[currentPos]) {
|
||||
countNum++;
|
||||
if(countNum % M == 0) {
|
||||
isEliminated[currentPos] = 1;
|
||||
eliminateCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("最终剩余%d个获胜座位:", K);
|
||||
for (int i = 1; i <= N; i++) {
|
||||
if (!isEliminated[i]) {
|
||||
printf("%d ", i);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||

|
||||
BIN
YueQian/Homework/1-30指针与数组作业.doc
Normal file
BIN
YueQian/Homework/1-30指针与数组作业.doc
Normal file
Binary file not shown.
BIN
YueQian/Homework/2-2数组与指针作业.doc
Normal file
BIN
YueQian/Homework/2-2数组与指针作业.doc
Normal file
Binary file not shown.
BIN
YueQian/Homework/2.3作业.docx
Normal file
BIN
YueQian/Homework/2.3作业.docx
Normal file
Binary file not shown.
BIN
YueQian/Homework/assets/1-29/file-20260129201415992.png
Normal file
BIN
YueQian/Homework/assets/1-29/file-20260129201415992.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
BIN
YueQian/Homework/assets/1-29/file-20260129202925505.png
Normal file
BIN
YueQian/Homework/assets/1-29/file-20260129202925505.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
YueQian/Homework/assets/1-29/file-20260129210143912.png
Normal file
BIN
YueQian/Homework/assets/1-29/file-20260129210143912.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
YueQian/Homework/~$2.3作业.docx
Normal file
BIN
YueQian/Homework/~$2.3作业.docx
Normal file
Binary file not shown.
BIN
YueQian/Homework/函数1.docx
Normal file
BIN
YueQian/Homework/函数1.docx
Normal file
Binary file not shown.
BIN
YueQian/Homework/指针.docx
Normal file
BIN
YueQian/Homework/指针.docx
Normal file
Binary file not shown.
BIN
YueQian/Homework/数组3.docx
Normal file
BIN
YueQian/Homework/数组3.docx
Normal file
Binary file not shown.
@@ -19,4 +19,5 @@ aliases: empty
|
||||
[I-Teaching](http://vm.yueqian.com.cn:8886)
|
||||
|
||||
|
||||
![[assets/相关网站/相关网站_Excalidraw20260121]]
|
||||
![[assets/相关网站/相关网站_Excalidraw20260121]]
|
||||
|
||||
Reference in New Issue
Block a user