Submission #145966

# Submission time Handle Problem Language Result Execution time Memory
145966 2019-08-21T13:13:27 Z grobar Prosjek (COCI14_prosjek) C++14
50 / 50
2 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    vector<int>v;
    v.push_back(a[1]);
    int sum=a[1];
    for(int i=2;i<=n;i++)
    {
        v.push_back(i*a[i]-sum);
        sum=sum+i*a[i]-sum;
    }
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i]<<endl;
    }
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++)
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct