UVa 10656- Maximum Sum (||)
Hello
I've written the below code for Maximum Sum || problem. Here is the linke:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1597
It's ought to get one integer at first which is the number of integers in a sequence. Then the sequence follows. I have to print out the maximum sum of a sequence.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
using namespace std;
int N, arr[1000];
int main()
{
while(cin>>N && N!=0)
{
int zero=0;
for(int i=0; i<N; i++)
{
cin>>arr[i];
if(arr[i]==0) zero++;
}
if(zero==N)
{
cout<<"0"<<endl;
}
else{
for(int i=0; i<N; i++)
if(arr[i]!=0)
cout<<arr[i];
cout<<endl;
}
}
return 0;
}
|
I got Presentation Error by online judge. Why is that?
I got Presentation Error by online judge. Why is that? |
Because your presentation doesn't match that described in the problem.
Two consecutive numbers in the output are separated by a single space |
Yes I corrected that part but still getting PE.
Topic archived. No new replies allowed.