|
|
back to boardWA 6? That is my code on c++ #include <iostream> #include <stdio.h> using namespace std; int main() { int k, n; scanf ("%d %d", &k, &n); int *mas = new int [n]; for (int i = 0; i < n; i++) { scanf("%d",&mas[i]); } int sum = 0; for (int i = 0 ; i < n ; i++) { sum+=mas[i] - k; } delete[]mas; if (sum<0) { sum = 0; cout<<sum; return 0; } cout<<sum; return 0; } |
|
|