Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. using namespace std;
  4.  
  5. int N;
  6. double S[1000010];
  7. double T;
  8. int A[4];
  9. int main() {
  10. //freopen("onoma.in","r", stdin);
  11. //freopen("onoma.out","w", stdout);
  12. cin >> N;
  13. for (int i=1;i<=N-1;++i) {
  14. cin >> S[i];
  15. S[i] = S[i] + S[i-1];
  16. }
  17. cin >> T;
  18. for (int i=0;i<4;++i) {
  19. cin >> A[i];
  20. if(i<3) {
  21. printf("%.2lf ", T + S[ A[i] ] );
  22. } else {
  23. printf("%.2lf\n", T + S[ A[i] ] );
  24. }
  25. }
  26. /* for (int i=0;i<4;++i) {
  27. double ans = T;
  28.  
  29. for(int j=1;j<= A[i] ;j++) {
  30. ans = ans + S[j];
  31. }
  32.  
  33. printf("%.2lf\n", ans);
  34. } */
  35.  
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement