본문 바로가기
Computer Science

A응실 달란트2 / 수식

by OKOK 2018. 12. 19.

1. 재귀식

2. 여러 개의 수식

3. 어떻게 하면?

4. 수식으로 만들 수 있는지 확인 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
 
int main()
{
    freopen("input.txt""r", stdin);
    int T, test_case;
    int N, P;
    long long int res;
    int i;
 
    scanf("%d"&test_case);
    for (T = 1; T <= test_case; ++T)
    {
        res = 1;
        scanf("%d %d"&N, &P);
        for (i = 0; i < P; ++i)
        {
            if (i < N % P)
                res *= (N / P + 1);
            else
                res *= (N / P);
        }
        printf("#%d %lld\n", T, res);
    }
 
    return 0;
}
 
cs


댓글