最新发布第35页
排序
【模拟】回文日期
题目 我的代码 import datetime ipt = input() begin = datetime.datetime(int(ipt[0:4]), int(ipt[4:6]), int(ipt[6:8])) flag1=0 flag2=0 while True: if flag1==1 and flag2==1: brea...
【Python】第一次实验
1 # 1、编写程序,生成一个包含20个随机整数的列表,然后对其中偶数下标的元素进行降序排列,奇数下标的元素不变。(提示:使用切片。) import random l1 = [random.randint(1,100) for i i...
【人工智能】仁爱人工智能路线
一、学习C++(大一 10月-1月) 大一进社团验收完C语言后开始学习C++,学到泛型即可(便于理解为什么python中不需要定义数据的类型)。 二、python基础和Anaconda的安装(大一1月-2月) 取消数据...
【递归】快速幂
class Solution: def myPow(self, x: float, n: int) -> float: if n==0: return 1 if n==1: return x if n==-1: ...
【递归】2的幂
递归法: class Solution: def isPowerOfTwo(self, n: int) -> bool: if n==1: return True if n<=0 or n%2!=0: return Fals...
【递归】斐波那契数
#include<iostream> using namespace std; int fib(int n){ if (n<2){ return n; } return fib(n-1) + fib(n-2); } int main(){ int n; cin >> n; cout << fib(n); return 0; } 数...