题解列表

筛选

优质题解

C++解决田忌赛马问题

摘要:解题思路:将双方马的速度放入矢量将双方马的速度进行排序逐一对比速度,记k为胜场如果胜场超过一半则输出结果如果不足一半则将老王马的速度整体前移1个位置,有一次超过则输出YES,否则继续循环当超过循环次数……

标准模板——bfs迷宫问题

摘要:解题思路:bfs刚好满足于queue的逻辑,运用queue对每次新的坐标入队具体代码如下参考代码:#include<iostream> #include<queue> using namespac……

c代码记录之回文数字

摘要:解题思路:注意事项:参考代码:#include<stdio.h> int fun5(int m){     int i,j,k,t=0;     for(i=1;i<=9;i++)    ……

大整数排序代码

摘要:#include<stdio.h> #include<math.h> #include<string.h> void swapstr(char*,char*); void swapstr(ch……

数组的距离

摘要:#解题思路 首先,这道题数据量不大,也不难,我们只需要从小到大排序一遍,找两个相邻的不同数组里元素的差最小的那个就行了,对于不同数组的这个条件,我们进行简单的记录一下就行,只需要遍历一次就行,没必要……

以数组的形式

摘要:解题思路:注意事项:参考代码:# include<stdio.h>int main(void){    int n;    int array[55];    for(n=1;n<=4;n++)   ……

2819: 数字反转

摘要:``` #include using namespace std; int main(){ int a,ans=0; cin>>a; while(a){ ans=ans*10+……