답안 #233743

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
233743 2020-05-21T15:39:59 Z DodgeBallMan 평균 (COCI14_prosjek) C++14
50 / 50
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 110;
int n, a[N], sum[N];
int main()
{
    scanf("%d",&n);
    for( int i = 1 ; i <= n ; i++ ) scanf("%d",&a[i]);
    for( int i = 1 ; i <= n ; i++ ) {
        a[i] = a[i] * i - sum[i-1];
        sum[i] = sum[i-1] + a[i];
    }
    for( int i = 1 ; i <= n ; i++ ) printf("%d ",a[i]);
    return 0;
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
prosjek.cpp:10:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= n ; i++ ) scanf("%d",&a[i]);
                                     ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct