Nusrat_Ullah

Timus 1149

Feb 1st, 2019
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void sin(int l,int mt)
  4. {
  5.     if(l+1==mt)return;
  6.     if(mt==1)printf("sin(%d",mt);
  7.     else if(mt%2)printf("+sin(%d",mt);
  8.     else printf("-sin(%d",mt);
  9.     sin(l,++mt);
  10.     printf(")");
  11. }
  12. int main()
  13. {
  14.     int q,g,w;
  15.     scanf("%d",&q);
  16.     for(g=1;g<q;g++)printf("(");
  17.     for(g=1,w=q;g<q;g++){
  18.         sin(g,1);
  19.         printf("+%d)",w--);
  20.     }
  21.     sin(g,1);
  22.     printf("+%d\n",w);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment