uq_83409387417


私信TA

用户名:uq_83409387417

访问量:497

签 名:

等  级
排  名 5188
经  验 1519
参赛次数 0
文章发表 1
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<stdlib.h>

#include<stdbool.h>

char a[2000];

void xh(int n);

int main(){

int n;

scanf("%d",&n);

xh(n);

puts(a);

return 0;

}

void xh(int n){

int r=floor((log(n))/(log(2)));

if((r-2)>0){

strcat(a,"2(");

xh(r);

strcat(a,")");

}

if((r-2)<=0){

if(r==1){

strcat(a,"2");

}else if(r==0){

strcat(a,"2(0)");

}else if(r==2){

strcat(a,"2(2)");

}

}

int yu=n-(int)pow(2.0,(int)r);

if(yu!=0){

strcat(a,"+");

xh(yu);

}else if(yu==0){

    return;

}

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区