[15439] 베라의 패션

RudinP·2023년 4월 13일
0

BaekJoon

목록 보기
44/77

베라는 상의 N 벌과 하의 N 벌이 있다. i 번째 상의와 i 번째 하의는 모두 색상 i를 가진다. N 개의 색상은 모두 서로 다르다.
상의와 하의가 서로 다른 색상인 조합은 총 몇 가지일까?

입력

  • 입력은 아래와 같이 주어진다.
    N

출력

  • 상의와 하의가 서로 다른 색상인 조합의 가짓수를 출력한다.

생각

n(n-1)을 출력하라는 문제이다.

처음 코드

namespace SongE
{
    public class Program
    {
        static void Main(string[] args)
        {
            using var input = new System.IO.StreamReader(Console.OpenStandardInput());
            using var print = new System.IO.StreamWriter(Console.OpenStandardOutput());

            int n = int.Parse(input.ReadLine());

            print.Write(n * (n - 1) );  
        }
    }
}

profile
곰을 좋아합니다. <a href = "https://github.com/RudinP">github</a>

0개의 댓글