티스토리 뷰

Baekjoon Solutions/Class-1

[백준] 개(10172)

률무차 2021. 3. 15. 19:45

title: "개(10172)"
category: 백준[Class-1]
tags: [C++, JavaScript, 백준]
date: "2021-03-15"


문제 링크

개(10172)

C++

#include <iostream>

using namespace std;

// 문제 풀이 함수
void solution(){
    string str="|\\_/|";
    str += "\n";
    str += "|q p|   /}";
    str += "\n";
    str += "( 0 )\"\"\"\\";
    str += "\n";
    str += "|\"^\"`    |";
    str += "\n";
    str += "||_/=\\\\__|";
    cout<<str<<endl;
}

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;
}

JavsScript

const fs = require("fs");
// split 조절
const input = fs.readFileSync("dev/stdin").toString().trim().split("\n");

// 문제 풀이
let str = "|\\_/|";
str += "\n";
str += "|q p|   /}";
str += "\n";
str += '( 0 )"""\\';
str += "\n";
str += '|"^"`    |';
str += "\n";
str += "||_/=\\\\__|";
console.log(str);
728x90
반응형

'Baekjoon Solutions > Class-1' 카테고리의 다른 글

[백준] X보다 작은 수(10871)  (0) 2021.03.16
[백준] 알파벳 찾기(10809)  (0) 2021.03.15
[백준] 고양이(10171)  (0) 2021.03.15
[백준] 시험 성적(9498)  (0) 2021.03.15
[백준] 나머지(3052)  (0) 2021.03.15
댓글
04-30 13:40
링크