Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int N;
- double S[1000010];
- double T;
- int A[4];
- int main() {
- //freopen("onoma.in","r", stdin);
- //freopen("onoma.out","w", stdout);
- cin >> N;
- for (int i=1;i<=N-1;++i) {
- cin >> S[i];
- S[i] = S[i] + S[i-1];
- }
- cin >> T;
- for (int i=0;i<4;++i) {
- cin >> A[i];
- if(i<3) {
- printf("%.2lf ", T + S[ A[i] ] );
- } else {
- printf("%.2lf\n", T + S[ A[i] ] );
- }
- }
- /* for (int i=0;i<4;++i) {
- double ans = T;
- for(int j=1;j<= A[i] ;j++) {
- ans = ans + S[j];
- }
- printf("%.2lf\n", ans);
- } */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement