|
|
back to boardwhy wrong ans? #include <iostream> #include <cstdio> using namespace std; int main() { int a, b, c[10000], n, p, sum = 0, i, k, s, m; scanf("%i %i", &a, &b); for(i = 1;i <= b ; i++) { scanf("%i", &c[i]); sum += c[i - 1]; } k = sum - a * (b - 1); if(k <= 0) { m = c[b] - a; if(m <= 0) printf("0\n"); else printf("%i\n", m); } else { n = (k + c [b]) - a; if(n <= 0) printf("0\n"); else printf("%i\n", n); } } Edited by author 20.11.2014 20:03 |
|
|