排序
【深基2.习6】Apples Prologue / 苹果和虫子
题目描述 八尾勇喜欢吃苹果。她现在有m(1<=m<=100)个苹果,吃完一个苹果需要花费 t(0<=t<=100)分钟,吃完一个后立刻开始吃下一个。现在时间过去了s(1<=s<=10000)分钟,...
【递归】斐波那契数
#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++】过河卒问题
无马情况 #include <iostream> // 定义棋盘大小 #define MAXSIZE 30 using namespace std; int main(){ int a[MAXSIZE][MAXSIZE]={0}; int n,m; // n,m为B点的坐标,A点默认为(0,0) cin >> n...
【算法】【Python】蓝桥杯Python组比赛技巧
本文介绍了Python在蓝桥杯比赛中的常用技巧,包括序列翻转、数字进制转换、数学表达式解析、自定义排序、遍历序列、数据结构操作、组合与排列生成、双端队列、阶乘计算、日期处理、字符计数、有...
【模拟】二进制求和
#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...
【C】五舍六入?
如果题目让你五舍六入,那么就没办法使用C++里的round函数了,只能选择一个通用的方法,示例如下: #include <stdio.h> #define PI 3.1415926 int main(){ double r,ans; scanf('%lf',&r...