排序
【算法】【Python】蓝桥杯Python组比赛技巧
本文介绍了Python在蓝桥杯比赛中的常用技巧,包括序列翻转、数字进制转换、数学表达式解析、自定义排序、遍历序列、数据结构操作、组合与排列生成、双端队列、阶乘计算、日期处理、字符计数、有...
【递归】斐波那契数
#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; } 数...
【C】二维数组每行冒泡排序
void sort2D(int arr[][cols], int rows, int cols) { int temp; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols - 1; j++) { for (...
【C】合并有序数组
#include <stdio.h> int main(){ int M,N; int a[]={1,3,5,6,8},b[]={1,2,5,7,8,9}; M=sizeof(a)/sizeof(a[0]); N=sizeof(b)/sizeof(b[0]); int c[M+N]; int i=0,j=0,k=0; //当有任何一个数...
【模拟】二进制求和
#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...