Advertisement
Saleh127

Timus 1149

Jul 30th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. void recursive(int i)
  4. {
  5. int j,k,l;
  6. for(j=1;j<=i;j++)
  7. {
  8. cout<<"sin("<<j;
  9. if(j==i)
  10. {
  11. for(k=0;k<i;k++)
  12. {
  13. cout<<")";
  14. }
  15. break;
  16. }
  17. else
  18. {
  19. if(j%2==1)
  20. {
  21. cout<<"-";
  22. }
  23. else cout<<"+";
  24. }
  25. }
  26. }
  27. int main()
  28. {
  29. ios_base::sync_with_stdio(0);
  30. cin.tie(0);cout.tie(0);
  31.  
  32. int n,c,i,j,k,l;
  33. cin>>n;
  34. for(i=1;i<n;i++)
  35. {
  36. cout<<"(";
  37. }
  38. c=n;
  39. for(i=1;i<=n;i++,c--)
  40. {
  41. recursive(i);
  42. if(i!=n)
  43. {
  44. cout<<"+"<<c<<")";
  45. }
  46. }
  47. cout<<"+1"<<endl;
  48. return 0;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement