Harolinch's blog

By Harolinch, 21 month(s) ago, In English

hello all, i'm trying to submit problems in Javascript, some submissions on codeforces use methods readline() and write() for std in/out which i can't find any reference or docs about it.

i'm using Vscode with node installed on windows.

how to write js code and debug it with std in/out on my environment with both mentioned above methods ?

 
 
 
 
  • Vote: I like it
  • -5
  • Vote: I do not like it

»
21 month(s) ago, # |
  Vote: I like it +1 Vote: I do not like it

read this https://codeforces.com/blog/entry/10024 and this https://codeforces.com/blog/entry/10594 Basically you need to install V8 — detailed on how to install on first blog. Use powershell termimal in VSCode like D8

  • »
    »
    21 month(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks really a lot for your help. i'm able now to write and test my code in js .

  • »
    »
    21 month(s) ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    i have only one problem, i downloaded V8 binaries that MikeMirzayanov provided in the blog to use d8. i don't know a lot about Js yet, but does d8 supports js es6 and later ? because it doesn't run this line of code successfully

    var x = readline().split(' ').map(y => parseInt(y));

    • »
      »
      »
      21 month(s) ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      not sure why its not working but may be you can try this

      var x = readline().split(" ").map(function(x) { return parseInt(x); });
      
      • »
        »
        »
        »
        21 month(s) ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        i tried it, it works perfectly on my computer. but i'm asking about es6 version that uses => operator, why not working ?

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          you downloaded the old v8 binaries

          • »
            »
            »
            »
            »
            »
            6 weeks ago, # ^ |
              Vote: I like it -8 Vote: I do not like it

            Do you have the latest binaries of v8 that supports ES6?