时间限制: 1Sec 内存限制: 128MB 提交: 180 解决: 116
3
((sin(1)+3)sin(1-sin(2))+2)sin(1-sin(2+sin(3)))+1
#include<stdio.h> void A(int cur,int n) { if(cur==n) { printf("sin(%d)",n); } else { printf("sin(%d%s",cur,cur%2==0?"+":"-"); A(cur+1,n); printf(")"); } } void S(int cur,int n) { if(cur==n) { A(1,1); printf("+%d",n); //printf("A1+%d",n); } else { printf("("); S(cur+1,n); //printf(")A%d+%d",n-cur+1,cur); printf(")"); A(1,n-cur+1); printf("+%d",cur); } } int main(void) { int n; scanf("%d",&n); //A(1,n); //printf("\n"); S(1,n); return 0; }
原文:https://www.cnblogs.com/zuimeiyujianni/p/8893837.html