题解 1180: 不容易系列

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

编写题解 1180: 不容易系列

摘要:解题思路:注意事项:参考代码:#include<stdio.h>void sum(int t){    int i;    int x=3;    for(i=1;i<=t;i++)    {    ……

不容易系列

```c#includeinthanshu(intk);//函数声明inthanshu(intk)//函数定义{intn=0,i;//n为第K站的绵羊的数量if(k==0)return3;//k==0,表示第0站,返回3,表示只有三只羊else{for(i=1;i

Manchester-【不容易系列-法2】

####解题思路:1.递推写出过每一站剩余的羊数目1.第一站剩余(n+2)/21.第二站剩余(n+2+4)/41.第三站剩余(n+2+4+8)/81.第a站剩余(n+2+4+8+...+2^a)/(2^a)1.所以n=2^a+2;```c#include#includeintmain(){inta,

不容易系列-题解(C语言代码)值得推荐

思路:利用递归的思想。如果没有收费站的花,则返回rest(本题中为3)如果有收费站且数量为n,则可以返回n-1个收费站的情况下有的羊的个数-1再乘2longlonginttol(intn){if(n==0)returnrest;elsereturn(tol(n-1)-1)*2;}题目:你活的不容易,

不容易系列 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int a,b,i; scanf("%d",&a); while(a--){  int sum=3;  scan……

不容易系列 (C语言代码)

摘要:解题思路:最后只剩下3只羊,所以每次都要拿剩下的羊减去1再乘以2注意事项:注意利用for循环和while循环参考代码:#include<stdio.h>int main(){    int n,a[1……

不容易系列 (C语言代码)

摘要:解题思路:每一次减1乘2,有几个站就做几次就可以了注意事项:多项输入,记得每次初始化为3参考代码:#include<stdio.h> int main() { int n; int a; ……

不容易系列 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int f(int n);int f(int n) {    int i, a=3;    for(i=0; i<n; i++) { ……