|
|
back to boardokay did it! =) #include<bits/stdc++.h> using namespace std; void prin ( int i) { int j; for ( j =1 ; j <= i ;j++) { cout << "sin(" << j; if ( j == i){ for (j = 0 ; j<i ; j ++) cout <<")"; break;} else { if (j%2) cout << "-"; else cout << "+"; } } } int main() { int i,j,n; cin >> n; int k = n; for (i = 1; i < n ;i++) cout << "("; for ( i = 1 ; i <= n ; i++,k--) { prin(i); if (i!= n) cout << "+"<<k<<")"; } cout << "+1\n"; return 0; } |
|
|