Submission #23050

# Submission time Handle Problem Language Result Execution time Memory
23050 2017-05-02T13:03:55 Z model_code Tarifa (COCI16_tarifa) C++11
50 / 50
0 ms 1116 KB
#include <cstdio>

using namespace std;

const int MAXN = 110;

int x, n;
int a[MAXN];

int main() {

    scanf("%d%d", &x, &n);

    int sum = 0;
    for(int i=0; i<n; i++){
        scanf("%d", a+i);
        sum += a[i];
    }

    printf("%d\n", x * (n + 1) - sum);
    
    return 0;
}

Compilation message

tarifa.cpp: In function 'int main()':
tarifa.cpp:12:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &x, &n);
                          ^
tarifa.cpp:16:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", a+i);
                         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 0 ms 1116 KB Output is correct
9 Correct 0 ms 1116 KB Output is correct
10 Correct 0 ms 1116 KB Output is correct