|
|
back to boardWrong 6 Posted by dima 17 Nov 2012 21:36 This is my code on C++. The wrong is in the test №6. Why? Help me, please. #include <iostream> using namespace std; int main() { int k, n, sum=0, a, i, mas[100]; cin >> k >> n; if (k>=1 && n<=100) { for (i=0; i <= n-1; i++) { cin >> mas[i]; if (mas[i] <= 100 && mas[i] >= 0) sum = sum + mas[i]; else continue; } a = n * k; if (sum > a) cout << sum - a << endl; if (sum <= a) cout << 0 << endl; } return 0; } |
|
|