摘要: 此题异常简单,代码如下,无注释 #include<stdio.h> #include<math.h> float hs(int a,int b,int c){ float s; s=(4.25*(a+b)+log(a+b+sqrt(a+b)+1/(a+b)))/(4.25*c+log(c+sqrt( 阅读全文
posted @ 2022-09-10 18:49 码羊 阅读(28) 评论(0) 推荐(0)
摘要: 代码如下//解析看注释即可 1 #include<stdio.h> 2 int main(){ 3 int a[5][5]={{11,4,2,7,8},{5,9,23,1,25},{3,22,21,18,15},{17,16,24,12,6},{13,10,19,20,14}};//定义如图所示的二 阅读全文
posted @ 2022-09-09 17:10 码羊 阅读(60) 评论(0) 推荐(0)
摘要: 此题异常简单 代码如下 1 #include<stdio.h> 2 int main(){ 3 int a,b,t; 4 char c; 5 printf("请输入两个操作数和一个运算符\n"); 6 scanf("%d%c%d",&a,&c,&b); 7 printf("%d%c%d\n",a,c 阅读全文
posted @ 2022-09-09 15:58 码羊 阅读(347) 评论(0) 推荐(0)
摘要: 简单的递归调用即可(注释提及) 代码如下 1 #include<stdio.h> 2 #include<stdlib.h> 3 float qbxf(int n,float x)//定义切比雪夫多项式 4 { 5 float s;//定义float型s,用来存放qbxf 6 if(n==0){ 7 阅读全文
posted @ 2022-09-08 21:58 码羊 阅读(274) 评论(0) 推荐(0)
摘要: 在一的基础上遍历出所有路径 只要jerry走到出口,即把一条路径遍历出来 每完成一次完整的模拟即把一条路径显示出来,接着返回上级把他设置为0,即可让这条已显示的路径重新模拟递归 代码如下 1 #include<stdio.h> 2 void walk(int ,int); 3 int jerry[9 阅读全文
posted @ 2022-09-07 22:16 码羊 阅读(68) 评论(0) 推荐(0)
摘要: 老鼠走迷宫问题,具体解释写在注释中,思考即可 代码如下 1 /*int jerry[7][7]={{2,2,2,2,2,2,2}, 2 {2,0,0,0,0,0,2}, 3 {2,0,2,0,2,0,2}, 4 {2,0,0,2,0,2,2}, 5 {2,2,0,2,0,2,2}, 6 {2,0,0 阅读全文
posted @ 2022-09-06 21:48 码羊 阅读(51) 评论(0) 推荐(0)
摘要: 假设有一条绳子,上面挂有红、白、蓝三种颜色的旗子,没有顺序,每次移动两个旗子,使得颜色顺序为蓝,白红顺序,同时移动次数最少。 求解:可以定义一个指针数组,用地址的指向来移动数组内部的值,把蓝色旗子移到数组前面部分,白色旗子移到中间部分,红色旗子移动到数组后面部分,定义开头和结尾分别为begin和en 阅读全文
posted @ 2022-09-05 20:10 码羊 阅读(61) 评论(0) 推荐(0)
摘要: 此题较为简单,只需定出后一项等于前两项之和即可 代码如下 1 #include<stdio.h> 2 #define N 100 3 void show(int a[N])//定义一个函数 4 { 5 for(int i=1;i<=20;i++){//输出斐波那契数列的前20项 (因为第一项定义为0 阅读全文
posted @ 2022-09-04 18:46 码羊 阅读(29) 评论(0) 推荐(0)
摘要: 定义两个函数即可解决 一个f(char a,char b)函数,一个g(int i,char a,char b,char c)函数 f函数表示把a上一个圆盘移动到b上, g函数表示把a上i个圆盘通过b移动到c上,重复操作即可解决问题。 代码如下 1 #include<stdio.h> 2 void 阅读全文
posted @ 2022-09-03 20:07 码羊 阅读(27) 评论(0) 推荐(0)