2024年02月的文章

【递归】斐波那契数 - AI科研 编程 读书笔记 - 小竹の笔记本

【递归】斐波那契数

我探讨了斐波那契数的求解方法。虽然直接使用递归是直观的,但它会因大量重复计算子问题而导致效率低下,在数据量大时容易超时。为了优化,我提出了两种基于“备忘录”思想的方法来避免重复计算...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
016215
【模拟】旋转矩阵 - AI科研 编程 读书笔记 - 小竹の笔记本

【模拟】旋转矩阵

#include<stdio.h> int main(){ int n; scanf('%d',&n); int a[n][n]; int top=0,down=n-1,left=0,right=n-1,count=1; while(count<=n*n){ for (int i=left;i<=right;i++){ a[top]...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
06110
【模拟】各位相加 - AI科研 编程 读书笔记 - 小竹の笔记本

【模拟】各位相加

#include<iostream> using namespace std; int main(){ int num; cin >> num; while(num>9){ int total=0; while(num!=0){ total+=num%10; num/=10; } num = total; total = 0; } cout <&...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
01656
【模拟】二进制求和 - AI科研 编程 读书笔记 - 小竹の笔记本

【模拟】二进制求和

#include <iostream> using namespace std; string addBinary(string a, string b){ string res; int carry = 0;  // 进位 int i = a.size() - 1; int j = b.size() - 1; while(i >= 0 || j...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
014514
【Python】学生信息管理系统示例 - AI科研 编程 读书笔记 - 小竹の笔记本

【Python】学生信息管理系统示例

import os.path  #导入os.path模块 def menm():    #菜单    print('==========================学生信息管理系统==========================')    print('----------------------------...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
01719
【Python】魔术方法自查 - AI科研 编程 读书笔记 - 小竹の笔记本

【Python】魔术方法自查

魔法方法含义基本的魔法方法new(cls[, ...])1. new 是在一个对象实例化的时候所调用的第一个方法 2. 它的第一个参数是这个类,其他的参数是用来直接传递给 init 方法 3. new 决定是否要使用该 i...
SmallBamboo的头像 - AI科研 编程 读书笔记 - 小竹の笔记本SmallBamboo1年前
01085