题解列表

筛选

母牛的故事(Python代码)

解题思路:运用递归的方法的话会因为效率低超时,所以用列表先直接将题目要求的限制年数的每一年的对应值直接放入列表中,每次输入年份n则将n对应列表里的数值输出即可。参考代码:a=[int(i)foriinrange(1,58)]//先创建一个列表,第一年到第四年为1,2,3,4,不用动。

数字逆序输出简便方法

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){   int a,b,c,d,e,f,g,h,i,j;    scanf("%d%d%d%d%d%d%d%d%d……

二级c语言-分段函数题解

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){     float  x,y;  scanf("%f",&x);     if(x<1)     y=x;   ……

二级C语言-分段函数题解

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<math.h>int main(){     float  x,y;  scanf("%f",&x);     if(……

分段计算题解

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int x,y; scanf("%d",&x);  if(x<3) y=2*x; else if(x<20) y……

考试评级 Switch 语句

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int x,y; scanf("%d",&x); y=x/10;  switch (y){ case 10: ……

边长判断有手就行

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int a,b,c,max,min,m; scanf("%d%d%d",&a,&b,&c); max=a>b?a……

春夏秋冬季节判断

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int a; scanf("%d",&a);    switch (a){    case 1:    ca……

排序条件运算

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){int a,b,c,max,min,m;scanf("%d%d%d",&a,&b,&c);max=a>b?a:b;……