JavaScript solution runner

Revision en15, by romanrich89, 2023-04-07 19:42:56

Hi competitive programmers and especially who writes problem solutions in JavaScript. I'm among them, yes I'm a little crazy too;)

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 solution and it looked 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

After reverse-engineering of 200985613 of Um_nik:

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 solution for [problem:1814A]:

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

Tags js, javascript, nodejs, um_nik

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en25 English romanrich89 2023-04-07 20:54:03 83
en24 English romanrich89 2023-04-07 20:50:04 1 Tiny change: 'er>\n\n### Oh, I ' -> 'er>\n\n#### Oh, I '
en23 English romanrich89 2023-04-07 20:00:36 0 (published)
en22 English romanrich89 2023-04-07 19:58:56 98
en21 English romanrich89 2023-04-07 19:58:03 92
en20 English romanrich89 2023-04-07 19:57:19 43
en19 English romanrich89 2023-04-07 19:56:09 94
en18 English romanrich89 2023-04-07 19:50:46 29
en17 English romanrich89 2023-04-07 19:47:32 6
en16 English romanrich89 2023-04-07 19:45:06 81
en15 English romanrich89 2023-04-07 19:42:56 50
en14 English romanrich89 2023-04-07 19:42:15 42
en13 English romanrich89 2023-04-07 19:41:17 1181
en12 English romanrich89 2023-04-07 19:31:24 59
en11 English romanrich89 2023-04-07 19:28:00 10
en10 English romanrich89 2023-04-07 19:27:03 26
en9 English romanrich89 2023-04-07 19:23:10 1180
en8 English romanrich89 2023-04-07 18:35:29 48
en7 English romanrich89 2023-04-07 18:30:48 83
en6 English romanrich89 2023-04-07 18:22:10 86
en5 English romanrich89 2023-04-07 18:19:31 67
en4 English romanrich89 2023-04-07 18:15:49 43
en3 English romanrich89 2023-04-07 18:13:44 330
en2 English romanrich89 2023-04-07 16:39:00 813
en1 English romanrich89 2023-04-07 16:13:34 3713 Initial revision (saved to drafts)