fork(1) download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. double a, sum = 0;
  8. double period = 2*M_PI;
  9. cin >> n;
  10.  
  11. for(int i=0; i<n; i++)
  12. {
  13. cin >> a;
  14. sum += a;
  15.  
  16. if ( fabs ( sum ) >= period )
  17. {
  18. sum = fmod( sum, period );
  19. }
  20. }
  21. cout << sin ( fabs ( sum )) ;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3476KB
stdin
3
1000 -100 -100
stdout
-0.89397