본문으로 건너뛰기

29751. 삼각형

🚧 이 문서는 현재 작업 중입니다! 🚧

이 문서는 현재 작업 중이며, 빠른 시일 내에 업데이트될 예정입니다.

문제 풀이

js
const testcases = [
  {
    input: '1 1',
    output: '0.5',
  },
  {
    input: '2 3',
    output: '3.0',
  },
  {
    input: '4 5',
    output: '10.0',
  },
];

function solution(input) {
  const [W, H] = input
    .trim()
    .split(' ')
    .map(val => Number(val));

  const width = (W * H) / 2;

  return width.toFixed(1); // `toFixed` returns a string.
}

export default { solution, testcases };
js
const testcases = [
  {
    input: '1 1',
    output: '0.5',
  },
  {
    input: '2 3',
    output: '3.0',
  },
  {
    input: '4 5',
    output: '10.0',
  },
];

function solution(input) {
  const [W, H] = input
    .trim()
    .split(' ')
    .map(val => Number(val));

  const width = (W * H) / 2;

  return width.toFixed(1); // `toFixed` returns a string.
}

module.exports = { solution, testcases };
ts
import type { Testcases, Input, Output } from 'bananass';

const testcases = [
  {
    input: '1 1',
    output: '0.5',
  },
  {
    input: '2 3',
    output: '3.0',
  },
  {
    input: '4 5',
    output: '10.0',
  },
] satisfies Testcases;

function solution(input: Input): Output {
  const [W, H] = input
    .trim()
    .split(' ')
    .map(val => Number(val));

  const width = (W * H) / 2;

  return width.toFixed(1); // `toFixed` returns a string.
}

export default { solution, testcases };
ts
import type { Testcases, Input, Output } from 'bananass';

const testcases = [
  {
    input: '1 1',
    output: '0.5',
  },
  {
    input: '2 3',
    output: '3.0',
  },
  {
    input: '4 5',
    output: '10.0',
  },
] satisfies Testcases;

function solution(input: Input): Output {
  const [W, H] = input
    .trim()
    .split(' ')
    .map(val => Number(val));

  const width = (W * H) / 2;

  return width.toFixed(1); // `toFixed` returns a string.
}

module.exports = { solution, testcases };

해설