会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
城市里的月光
记录美好,分享日常
博客园
首页
新随笔
新文章
联系
订阅
管理
2021年5月22日
c++中map用法(以整数分解为例)
摘要: #include <map>#include <iostream>using namespace std; map<int, int> prime_factor(int n){ map<int, int> res; for(int i = 2; i * i <= n; ++i){ while(n %
阅读全文
posted @ 2021-05-22 16:24 城市里的月光
阅读(234)
评论(0)
推荐(0)
2021年5月13日
整数分解-利用python字典实现
摘要: def divisor(n): #建立一个空字典 dic = {} i = 2 while i * i <= n: while n % i == 0: #判断i是不是dic的一个键,如果是则遍历字典,把键为i的值更新 if i in dic: dic[i] = dic[i] + 1 #不是dic的一
阅读全文
posted @ 2021-05-13 17:20 城市里的月光
阅读(209)
评论(0)
推荐(0)
2021年5月6日
Python中创建树
摘要: class Node: #构造函数,内置了data参数 def __init__(self, data=""): self.data = data #左右孩子都为None self.lc = None self.rc = None #前序遍历 def pre_order(a): if(a): pri
阅读全文
posted @ 2021-05-06 19:37 城市里的月光
阅读(545)
评论(0)
推荐(0)