ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1585. Penguins

Help me to find a mistake please!
Posted by RoskaTa 3 Jul 2008 00:28
This is my source

[code deleted]


What is wrong?
I can't find any mistakes but i always get WA!
Please Help me to find my mistake!
Thank you!

Edited by author 03.07.2008 00:29

Edited by author 05.07.2008 20:59
Re: Help me to find a mistake please!
Posted by Seyyed Mehran Kholdi 4 Jul 2008 03:19
there are many notes which may help you make your code CLEANer
and finding your mistake:
1. use scanf("%d\n",&n) instead of cin>>n (because there cin will not read the '\n' and it will be read by getline)
2.This part may be shortened
for(j=0;j<sz;j++)
{
if(j==0&&s[j]=='L')br++;
else
if(j==0&&s[j]=='M')br1++;
else
if(j==0&&s[j]=='E')br2++;
}
INSTEAD:
if(s[j]=='L')br++;
else if(s[j]==....
3. and do not bother yourself with finding the maximum number in this way. you can make it shorter
Re: Help me to find a mistake please!
Posted by RoskaTa 5 Jul 2008 20:58
I understood my mistakes and they ware very silly.
Thank you Seyyed for helping me ;)

Edited by author 30.08.2008 20:34