题解列表

筛选

解决猴子吃桃问题

解题思路:我们可以使用一下试数的办法,将问题给表达出来,例如第三天的时候只剩一个,得出表达式为:第三天剩余:f(3)=1;第二天剩余:f(2)=2*(f(3)+1);第一天剩余:f(1)=2*(f(2)+1);由上面的式子我们可以得到一个规律,

母牛的故事--不用递归

解题思路:前四年都是正常的一年一只,第五年开始等于前一年与前三年的小牛总和。注意事项:参考代码:#includeintmain(){inta[56]={0,1,2,3,4},i,n;while(scanf("%d",&n)!=EOF&&n){if(n<=4){printf("%d\n",

应该算是比较简单的方法了

```cpp#include#includeusingnamespacestd;//输入三个字符串,按由小到大的顺序输出intmain(){stringarr[3];for(inti=0;i<3;i++){cin>>arr[i];}for(inti=0;i<2;i++){for(intj=0;j<2-

公式法求解

解题思路:等差公式前n项和:Sn=na1+n(n-1)d/2=(a1+an)n/2.注意事项:参考代码:n=int(input())a1,an=2,2+3*(n-1)print(int((a1+an)*n/2))

列表储存运算

摘要:解题思路:第一行应付格式注意事项:参考代码:n=input() a=list(map(int,input().split())) b=0 for i in a:     if i%2==0: ……

凑个数。。。。。

摘要:解题思路:。。。。。。。。。。。。。。。注意事项:。。。。。。。。。。。。。。。参考代码:x = float(input()) if x < 1:    y = x elif x >= 1 an……

温度转换,两行

摘要:解题思路:。。。。。。。。。。。。。。。。。注意事项:。。。。。。。。。。。。。。。参考代码:f=int(input()) print(&#39;{:.2f}&#39;.format(5/9*(f-……

字符格式化

摘要:解题思路:。。。。。。。。注意事项:。。。。。。。。。参考代码:n=int(input()) print(format(int(oct(n),8),&#39;o&#39;))……