10656 - Maximum Sum (II)
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10656 - Maximum Sum (II)
Check input and AC output for thousands of problems on uDebug!
Re: 10656 - Maximum Sum (II)
getting PE. please help
Code: Select all
CODE REMOVED
Last edited by sejan on Wed Nov 19, 2014 7:23 pm, edited 2 times in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10656 - Maximum Sum (II)
Input:AC output:
Code: Select all
6
3 4 0 3 4 5
5
1 0 0 0 2
3
0 0 0
4
0 0 1 2
Code: Select all
3 4 3 4 5
1 2
0
1 2
Check input and AC output for thousands of problems on uDebug!
Re: 10656 - Maximum Sum (II)
outputs matched but still PE
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10656 - Maximum Sum (II)
Don't print a space at the end of a line.
Check input and AC output for thousands of problems on uDebug!
Re: 10656 - Maximum Sum (II)
tried but then it gives "wrong answer"brianfry713 wrote:Don't print a space at the end of a line.
Re: 10656 - Maximum Sum (II)
Try it again. One way to do it
Code: Select all
int t = 0;
for(i=0; i<tc; i++)
{
if(a[i]!=0)
printf("%s%d", t++ ? " " : "", a[i]);
}
printf("\n");
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 10656 - Maximum Sum (II)
Accepted thank you