Submission #932063

# Submission time Handle Problem Language Result Execution time Memory
932063 2024-02-22T21:31:35 Z nomu Prosjek (COCI14_prosjek) C++17
50 / 50
1 ms 348 KB
// Example program
#include <iostream>
#include <string>

using namespace std;

int main() {
    int n, x;
    cin >> n;
    int a[100];
    int b[100];
    int i = 0;
    int sum = 0;
    while ( cin >> x ) {
        b[i] = x;
        ++i;
        if (cin.peek() == '\n') {
            break;    
        }
    }
    for ( int i = 0; i < n; ++i ) {
        cout << (i+1)*b[i] - sum << " ";
        sum += (i+1)*b[i] - sum;
    }
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:10:9: warning: unused variable 'a' [-Wunused-variable]
   10 |     int a[100];
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct