티스토리 뷰

Baekjoon Solutions

[백준] 환경 설정

률무차 2021. 3. 10. 01:27

환경 설정

온라인 코드 에디터 활용

repl.it/

 

The collaborative browser based IDE

Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages.

repl.it

회원가입 후에 Create new repl

Create new Repl

C++ Algorithm 생성

  • cin, cout 으로 백준 입출력 제어

    #include <iostream>
    
    using namespace std;
    
    // 문제 풀이
    void solution(){
        // cin 조절
        int a=0, b=0;
        cin >> a >> b;
    
        cout << a + b;
    }
    
    bool exists(const char* fileName){
        FILE* fp;
        if((fp = fopen(fileName, "r"))){
            fclose(fp);
            return true;
        }
        return false;
    }
    
    int main() {
        if(exists("stdin")){
            freopen("stdin", "r", stdin);
            solution();
            fclose(stdin);
        }
        else{
            solution();
        }
    
        return 0;
    }
  • Settings

    • 분할 페이지에 용이하도록 Layout: stacked
    • C++의 Indent type: space, Indent size: 4
      C++ Settings

JS Algorithm 생성

  • dev/stdin/ 입출력

    • dev 폴더 생성 후 stdin파일(확장자 X) 생성

    • stdin 파일에다가 백준 입력 예제 입력하기 위해서

      const fs = require("fs");
      // split 조절
      const input = fs.readFileSync("dev/stdin").toString().trim().split(" ");
      
      // 문제 풀이
      console.log(+input[0] + +input[1]);

JS 입출력

  • Settings
    • JS의 Indent type: space, Indent size: 2

JS Settings

728x90
반응형
댓글
05-14 14:12
링크