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 1991. The battle near the swamp

easy translation
Posted by Mattiev Jamol 11 Nov 2013 13:56
        if(a[i]<k){
       ans+=k-a[i];
        }
        else{
       ans1+=a[i]-k;
        }
Re: easy translation
Posted by Egor 20 Sep 2015 18:33
I think that this problem is easy enough to try to make the solution as efficient as possible.

My consideration notes:
1. You can make it without using arrays, because the local information that you get is enough to generate the answer.
2. I think that it is worth trying to make the speaking variable names. It will certainly require additional time, but I think, it should pay off in the future.
Re: easy translation
Posted by IlushaMax 12 Mar 2016 18:00
Any good book (about Pascal for example) will tell about it
Re: easy translation
Posted by Anton Smoliakov 24 Jan 2022 14:41
Ho do they get 0.001 seconds?