|
|
вернуться в форумWhats wrong with my code- Failing Test 6! Whats wrong with my code. I get correct answer for Test 6 on my compiler, but when I submit the solution, I get wrong answer. Please help!! I tried with below values and got correct answer 4 3 3 4 5 Correct answer: 1 #include <iostream> using namespace std; int main() { int a,k,n,d; int b=0; cin>>k>>n>>d; for (int i=0;i<n-1;i++) { cin>>a; a=a-k; b=b+a; } if (d-k>=0) { if (b+d-k>=0) cout<<b+d-k; else cout<<0; }
else if (b>0) cout<<b; else cout<<0; char f; cin>>f; } Re: Whats wrong with my code- Failing Test 6! I have some problem, try 5 4 3 , you must have 0. |
|
|