自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

weixin_45850271的博客

学习 记录

  • 博客(39)
  • 收藏
  • 关注

原创 【无标题】

Q:使用poetry install时,项目指定了^3.10,但是还是安装了3.11,以为是系统默认3.11,但是修改成3.10后,它还是使用3.11,且poetry env use命令不能直接找到3.10。A:结果是一直处在conda的base环境下导致的,且由于poetry不能自动安装python,最终也没有找到直接切换的方式,到头来重新安装,使用poetry env use <本地python解释器路径>,先创建好对应python版本的环境,然后使用poetry install 安装。

2023-06-30 15:49:39 61

原创 latex+texlive在插入参考文献时的一些问题

使用bib引用参考文献第一步 创建bib文件在tex文件的同一目录下新建一个文本文件改后缀为bib就可以,起名比如reference。第二步 插入bibtex格式的参考文献代码比如在Google学术中找到一篇要引用的文章点击引用点击bibtex就会出现下面的代码然后用texstudio打开刚才新建的bib文件,将代码复制粘贴进去。开头是相当于取个别名,这里我取的是pca,等会引用就用这个。第三步 在tex文件中引用首先要插入包\us...

2022-04-16 15:35:07 2301

原创 1-79合并数组

我的代码#include <stdio.h>#include <stdlib.h>int main() { int n, m, i, j; scanf("%d%d", &n, &m); int a[n], b[m]; for (i = 0; i < n; ++i) scanf("%d", &a[i]); for (i = 0; i < m; ++i) sca...

2022-03-22 15:47:27 95

原创 1-82链表操作2

我的代码#include <stdio.h>#include <stdlib.h>typedef struct LNode { int data; struct LNode *next;} LNode, *LinkList;LinkList List_HeadInsert() { LinkList L, p; int n, flag = 1; L = (LinkList) malloc(sizeof(LNode))...

2022-03-22 15:22:17 947

原创 1-78链表操作

我的代码#include <stdio.h>#include <stdlib.h>typedef struct LNode { int data; struct LNode *next;}LNode, *LinkList;LinkList List_TInsert() { LinkList L, p, r; int n, x; L = (LinkList) malloc(sizeof(LNode)); r = ...

2022-03-21 19:45:24 1040

原创 1-135删除字符

我的代码输入是真的折磨啊#include <stdio.h>#include <stdlib.h>void delchar(char *str, char c) { int count = 0; char *p = str; while (*(p + count) != '\0') { while (*(p + count) == c) ++count; *p = *(p + co...

2022-03-12 14:07:15 54

原创 1-133报数

我的代码时间复杂度在O(mn)~O(n^2),好烂,但我想不出什么好方法。#include <stdio.h>#include <stdlib.h>void CountOff(int n, int m, int out[]) { int a[n], loc = -1; for (int i = 0; i < n; ++i) a[i] = 1; for (int i = 0, j = m; i < n; ++...

2022-03-11 18:53:33 49

原创 1-75新的A+B

我的代码#include <stdio.h>#include <stdlib.h>int main() { int a, b, flag = 0; char c; scanf("%d", &a); if ((c = getchar()) != ' ' || a <= 0 || a > 1000) { printf("?"); flag = 1; if (c != '...

2022-02-26 12:21:41 48

原创 1-73划拳

我的代码#include <stdio.h>#include <stdlib.h>int main() { int max1, max2, N, x1, y1, x2, y2, count1 = 0, count2 = 0; scanf("%d%d%d", &max1, &max2, &N); while (N--) { scanf("%d%d%d%d", &x1, &y1, &...

2022-02-26 11:41:05 74

原创 1-72字符串转换为10进制整数

我的代码#include <stdio.h>#include <stdlib.h>int main() { char c; int len = 0, flag = 0, a[8] = {0}; long int ans = 0; while ((c = getchar()) != '#') { if (c == '-') flag = 1; if (c >= '0' &am...

2022-02-26 11:17:00 84

原创 1-69人名统计

我的代码#include <stdio.h>#include <stdlib.h>int main() { char s[1000][10]; int i = 0, count[1000] = {0}, max = 0, min = 1000; while (scanf("%s", &s[i]) != EOF) { if (s[i][0] == '#') break; fo...

2022-02-25 11:39:47 386

原创 1-65查看书籍

我的代码#include <stdio.h>#include <stdlib.h>int main() { int n,max=0, min=0; float *price; scanf("%d",&n); getchar(); //读完数字读取换行符 price = (float *) malloc(sizeof(float) * n); char **s; s = (...

2022-02-25 09:48:43 317

原创 1-64分隔字符

我的代码这题就一直修修补补,注释已经写不动了,还好最后性能还行。#include <stdio.h>#include <stdlib.h>void func(char *s, int n) { int alphabet[26] = {0}, max = 0, loc1 = 0, loc2, flag = 0; for (int i = 0; i < n; ++i) alphabet[s[i] - 97]++; ...

2022-02-23 13:04:59 427

原创 1-43数字游戏

我的代码#include <iostream>using namespace std;void func(int n, int k, int T) { long long int sum = 1, x = 1, t = 1; //t是加数,x是现在报的数 while (T - 1) { x += (t + t + n - 1) * n / 2; //连加公式 x %= k; t = (t + n) %...

2022-02-18 19:26:41 2638

原创 1-47幸运数

我的代码#include <iostream>using namespace std;int luckynum(int m, int n) { int k = n - 1, count = 0; //k记录小于n的数的数量 int *a = new int[n - 1]; for (int i = 0; i < n - 1; ++i) //开区间所以到n - 1 a[i] = i + 1;...

2022-02-18 12:43:31 255

原创 1-23打印十字图

我的代码#include <iostream>#include <stdio.h>using namespace std;void print(int n) { cout << ".."; for (int i = 0; i < n * 4 + 1; ++i) cout << "$"; cout << ".." << endl << "..$"; ...

2022-02-17 21:26:30 286

原创 1-106兔子繁衍问题

我的代码#include<iostream>using namespace std;int birth(int n) { if (n == 1) return 1; int a[3] = {1, 1, 2}; for (int i = 0, month = 3;; ++month, i = (i + 1) % 3) { if (a[(i + 2) % 3] >= n) return m...

2022-02-16 20:08:09 7922

原创 1-40连号区间数

我的代码1.0#include<iostream>using namespace std;int count(int *a, int n) { int result = n + 1; for (int i = 2; i < n; ++i) //测试不同区间长度 for (int j = 0; j + i <= n; ++j) { //max - min + 1 = n 则为连续区间 ..

2022-02-13 20:27:55 415

原创 1-36兰顿蚂蚁

#include<iostream>using namespace std;void walk(int** a, int x, int y, char s, int k){ char c[4] = {'U', 'R', 'D', 'L'}; int t; for(int i = 0; i < 4; ++i) if(c[i] == s) t = i; while(k){ if(a[x][y]){ a[x][y] = 0; s = c[++t % 4].

2022-02-13 14:27:30 198

原创 1-17芯片测试

我的代码这题test case not found, 我也不知道我写的对不对#include<iostream>using namespace std;void func(int** a, int n){ int count[n] = {0}; //记录每个芯片被测试为好芯片的次数 for(int i = 0; i < n; ++i){ for(int j = 0; j < n; ++j) count[i] += a[i][j]; if(c...

2022-02-09 11:59:50 547

原创 1-16完美的代价

我的代码修修补补半天,而且并没有严格证明出为什么这样是最少交换,凭直觉右边等于左边试了一下,,,如果这题交换是直接交换两个字符,,,算了不想了#include<iostream>using namespace std;int func(char* a, int n){ //count记录交换次数,flag标记有几个单独的字符,超过一个就不可能 //如果恰好有一个单独的字符且n为奇,用mid记录其位置,先跳过它,最后移到中间 int count = 0, flag ...

2022-02-09 11:01:53 341

原创 1-15数的读法

我的代码救命,这题真的写的都不如,我看都不想看一眼我的代码,ac率百分之40+,有没有人带带我.#include<iostream>using namespace std;void number(int n){ switch(n){ case 0: cout << "ling" << " "; break; case 1: cout << "yi" << " "; break; cas...

2022-02-06 21:13:40 274

原创 1-13矩阵乘法

#include<iostream>using namespace std;float S(float a, float b, float c, float d){ //求矩形面积,参数为相对顶点的坐标 return abs(c - a) * abs(d - b);}

2022-02-06 17:10:34 296

原创 1-18字符串对比

我的代码#include<iostream>#include<algorithm>#include<string>using namespace std;string lower(string s){ transform(s.begin(), s.end(), s.begin(), ::tolower); return s;}int cmp(string s1, string s2){ if(s1.length() != s2.leng...

2022-01-30 19:35:16 580

原创 1-117使用函数输出指定范围内的Fibonacci数

我的代码#include<iostream>using namespace std;int fib(int n){ //返回第n项Fibonacci数 if (n == 1 || n == 2) return 1; else return fib(n-1) + fib(n-2);}void PrintFN(int m, int n ){ int flag = 0, k = 1; while(fib(k) < m) k++; //找到第一项大于等...

2022-01-28 16:26:22 5483

原创 1-130拆分实数的整数与小数部分

我的代码#include<stdio.h>void splitfloat( float x, int *intpart, float *fracpart){ *intpart = x / 1; *fracpart = x - *intpart;}int main(){ float x, *fracpart; int *intpart; scanf("%f", &x); splitfloat(x, intpart, fracpart); printf...

2022-01-28 16:01:18 254

原创 1-67输出学生成绩

我的代码#include<stdio.h>#include<stdlib.h>void grade( int list[], int n){ float max = list[0], min = list[0], average = 0; for(int i = 0; i < n; ++i){ if(list[i] < min) min = list[i]; if(list[i] > max) max = list[i]...

2022-01-28 15:52:05 721

原创 1-131在数组中查找指定元素

我的代码#include<stdio.h>#include<stdlib.h>int search( int list[], int n, int x ){ for(int i = 0; i < n; ++i) if(list[i] == x) return i; return -1;}int main(){ int n, x, *list; scanf("%d", &n); list = (int*)malloc(sizeo...

2022-01-28 13:21:56 131

原创 1-11阶乘计算

我的代码#include<iostream>using namespace std;void factorial(int n){ int a[10000] = {0}, //存储各位 flag = 0; //记录到第几位了 a[0] = 1; for(int i = 1; i <= n; ++i){ int k = 0; //进位 for(int j = 0; j <= flag; ++j){ a[j] = a[j] * i + k; //每位..

2022-01-27 21:04:52 314

原创 1-36回文数字

我的代码#include<iostream>using namespace std;int isPalindrome(int n, int k){ //判断一个数是否是回文数,且各位相加等于k. int x = 0, y = 0, m = n; while (n){ x *= 10; x += n % 10; y += n % 10; n /= 10; } //x是n的倒序数,y是各位之和,判断是否相等. if (y == k && ...

2022-01-27 19:33:48 157

原创 1-10回形取数

我的代码#include<iostream>#include<vector>using namespace std;int output(vector<vector<int>> arr, int m, int n, int k){ //逆时针打印矩阵外圈 int i = 0, j = 0; //起点坐标 for(; i < m - 1; i++){ cout << arr[i+k][j+k] << " ..

2022-01-23 17:55:06 105

原创 1-9龟兔赛跑预测

我的代码#include<iostream>using namespace std;int T(int v2, int l){ //乌龟到达终点所需时间 return l / v2;}int R(int v1, int v2, int t, int s, int l){ //兔子到达终点所需要的时间 int time1, time = 0, d = 0; //领先t米花费时间, 跑过的总时间,距离 while(d < l ){ //越过终点停止 ..

2022-01-23 14:20:05 149

原创 1-7分解质因数

我的代码#include<iostream>#include<math.h>using namespace std;bool isPrime(int n){ if(n == 2) return 1; for (int i = 2; i <= sqrt(n); ++i) if(n % i == 0) return 0; return 1; //判断是否是素数}void factorize(int n){ //质因数分解并输出 co

2022-01-22 22:23:16 378

原创 1-6报时助手

我的代码#include<iostream>using namespace std;char num[25][20]={"zero","one","two","three","four","five","six","seven","eight", "nine","ten","eleven","twelve","thirteen","fourteen","fifteen", "sixteen","seventeen","eighteen","ninet.

2022-01-22 21:42:20 164

原创 1-4 Huffuman树

目录我的垃圾代码​网上的代码学习反思我的代码#include<iostream>using namespace std;int cost(int* arr, int left, int right){ int first = left, second = left + 1; if(right == second) return arr[first] + arr[second]; if(arr[first] > arr[second] ) .

2022-01-22 20:18:37 270

原创 数值分析--matlab拉格朗日型插值、牛顿型插值、龙格函数

这里写目录标题作业要求一、Lagrange型插值多项式1.基函数 lkl_klk​及插值多项式函数(符号)代码示例2.基函数 lkl_klk​及插值多项式函数(数值)代码3.测试4.拟合图像二、Newton型插值多项式1.函数三、Runge函数1.等距点插值测试拟合图像2.切比雪夫点插值测试拟合图像作业要求一、Lagrange型插值多项式1.基函数 lkl_klk​及插值多项式函数(符号)代码function[Ln, lk] = Lnx(n)x = sym('x');xi = sym('x'

2021-04-24 21:40:37 5368

原创 数值分析--matlab秦九韶算法

作业要求:编写计算多项式值的秦九韶方法,并用该方法计算 P(x)=1+2*x+3*x^2+4*x^3+5*x^4在x=1/2时的值代码:x = input(" ");a = [5 4 3 2 1];b = a(1);i = 2;while (i <= 5)b = b * x + a(i);i = i + 1;endb运行结果...

2021-04-24 20:54:15 4955

原创 数值分析--matlab刘徽割圆术

学习目标:提示:这里可以添加学习目标例如:一周掌握 Java 入门知识学习内容:提示:这里可以添加要学的内容例如:1、 搭建 Java 开发环境2、 掌握 Java 基本语法3、 掌握条件语句4、 掌握循环语句学习时间:提示:这里可以添加计划学习的时间例如:1、 周一至周五晚上 7 点—晚上9点2、 周六上午 9 点-上午 11 点3、 周日下午 3 点-下午 6 点学习产出:提示:这里统计学习计划的总量例如:1、 技术笔记 2 遍2、CSDN 技术博客 3 篇

2021-04-24 20:43:20 1552 2

原创 数值分析--matlab迭代求根式

作业要求:任意给定正实数a; 编写程序计算根号a的程序 并与matlab⾃带命令”sqrt”⽐较计算结果。代码:a=input(" ");%输入要开根的数x=floor(sqrt(a));%迭代初始值y=1/2*(x+a/x);while(abs(x-y)>1e-2)%迭代精度 x=y; y=1/2*(x+a/x);endvpa(y,9)%控制精度vpa(sqrt(a),9)...

2021-04-24 20:08:26 1571 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除