您的位置:首页 > 其它

NOIP 2001 普及组 复赛 数的计算

2017-03-16 14:28 477 查看
 NOIP 2001 普及组 复赛 数的计算

//洛谷 p1028 数的计算

//难度:普及-

//考点:输入,输出 ,递归  

//适用:小学生

//小技巧:先将各种情况打印出,之后注释,再进行各种可能结果统计。

//疑惑:测试n=1000,明显超时,但提交AC,很明显,数据弱

#include <stdio.h>

//int a[1000];

//int pos;

long long count=0;

void fun(int n){

    int i,j,top;

    for(i=1;i<=n/2;i++){

        /*pos++;

        a[pos]=i;

        top=pos;

        printf(",");

        for(j=top;j>=0;j--)

            printf("%d",a[j]);*/

        count++;

        fun(i);

        //pos--;

    }

}

int main(){

    int n;

    scanf("%d",&n);

    /*printf("%d",n);

    pos=0;

    a[pos]=n;*/

    count++;

    fun(n);

    printf("%lld\n",count);

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: