[백준 1010] 다리 놓기

alsry._.112·2023년 10월 18일
0

백준

목록 보기
87/102

🔗문제 풀러가기
단계별로 풀어보기 단계 19의 5번째 문제이다.

문제 분석

코드

#include <iostream>
using namespace std;

int main() 
{
    int t, n, k;
    cin >> t;

    for (int i = 0; i < t; i++)
    {
        cin >> n >> k;

        int result = 1, temp = 1;

        for (int j = k; j > k - n; j--)
        {
            result = result * j;
            result = result / temp;
            temp++;
        }

        cout << result << endl;
    }
}      
profile
소통해요

0개의 댓글