Блог пользователя romanrich89

Автор romanrich89, история, 14 месяцев назад, По-английски

Hi competitive programmers and especially who writes problem solutions in JavaScript.

I've already participated in two contests. In first for div 2 I've managed to solve 2 problems, but in next for div 3 I've just solved 1 and was a little disappointed about that. I decided to skip next one but curiosity took over me and I've looked to first problem in such an epic contest Educational Codeforces Round 146 (Rated for Div. 2).

1814A - Coins after some thinking about and scratching some expressions on paper I saw a math model of the solution. It looked easy like to transfer 2 bits over wire and I jumped in contest room but failed( My assumptions were wrong( But thanks to Codeforces I can see other's solutions like 200985613 of Um_nik and I've updated my JS code but it kept failing.

Thanks to shakhnoov I figured it out and now I'm presenting you JavaScript solution runner CodeforcesIO and for testing CodeforcesTester.

You if you found it helpful for you than I'm really glad! Thank you and happy coding!

CodeforcesIO: template to write your JS solution
CodeforcesTester: to check with test input/output data

Oh, I beg your pardon I've also tried to crack how Um_nik's mind works;) After reverse-engineering of his solution for 1814A - Coins:

bool solve() {
	ll n, k;
	scanf("%lld%lld", &n, &k);
	if (n % 2 == 0) return true;
	if (n >= k && (k % 2 == 1)) return true;
	return false;
}
I've got these steps of thinking how to come to the solution:

Am I right? How do you think? Please, leave some comments;)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится