치춘짱베리굿나이스

[백준] 24860 본문

Javascript + Typescript/자바스크립트로 알고리즘풀기

[백준] 24860

치춘 2022. 6. 25. 12:13

Counting Antibodies

문제

Immunoglobulins also known as antibodies are protein molecules. Antibodies play one of the key roles in the immune reaction --- they detect harmful foreign agents --- bacteria or viruses --- and help to eliminate them. Every foreign molecule binds with unique type of antibody. There are plenty of potential harmful agents, so, there should be a tremendous number of immunoglobulin types to neutralize all threats. Huge required amount of immunoglobulin types make it impossible to encode each type in DNA. Luckily, there is a solution.

Immunoglobulins are produced by immune cells: B-lymphocytes based on DNA information --- genes. Immunoglobulin genes are combined from DNA fragments like constructor. Each fragment exists in several variants and is responsible for variable region of immunoglobulin molecule. This process is called somatic recombination.

Immunoglobulin molecule consists of two identical heavy chains and two identical light chains. There are two types of light chains with similar structure --- κ and λ. Both of two light chain types have two variable regions --- V and J. To form a variable region one gene fragment is selected from multiple variants: Vκ and Jκ variants for V and J regions respectively in κ-light chain, or and variants for V and J regions respectively in λ-light chain.

There is only one heavy chain type with three variable regions --- V, D and J. To form each of them one gene fragment from Vh, Dh and Jh variants respectively is selected.

You need to count how many possible immunoglobulin molecules can be produced for given values of , , , , Vh Dh and Jh

입력

The first line contains two integers , (1≤Vκ,Jκ≤1500) --- number of gene fragment variants for κ-light chain V and J variable regions, respectively.

The second line contains two integers , (1≤Vλ,Jλ≤1500) --- number of gene fragment variants for λ-light chain V and J variable regions, respectively.

The third line contains three integers Vh, Dh and Jh (1≤Vh,Dh,Jh≤1000) --- number of gene fragment variants for heavy chain V D and J variable regions, respectively.

출력

Output one integer --- number of immunoglobulin variants that can be produced.

풀이

const gene = () => {
  let [k, l, h] = require("fs")
    .readFileSync("/dev/stdin")
    .toString()
    .trim()
    .split("\n")
    .map((v) => v.split(" ").map(Number));
  console.log(h[0] * h[1] * h[2] * (k[0] * k[1] + l[0] * l[1]));
};

gene();

반성회

거창하게 잔뜩 써있지만 사실 κλ 중 하나를 선택하여 VJ를 각각 고르고 (k[0]*k[1] + l[0]*l[1]), Vh, Dh, Jh 중 하나를 고르면 된다 (h[0] * h[1] * h[2])

'Javascript + Typescript > 자바스크립트로 알고리즘풀기' 카테고리의 다른 글

[백준] 20492  (0) 2022.06.26
[백준] 2910  (0) 2022.06.25
[백준] 25238  (0) 2022.06.25
[백준] 1032  (0) 2022.06.25
[백준] 24086  (0) 2022.06.25
Comments