1. 규칙을 찾는 문제임
2. res 의 규칙을 찾는 문제
3. 오케이
4. 어떻게 풀이해야 하는지 감이 옴
#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;
}
'Algorithms > simulation' 카테고리의 다른 글
작업순서 (0) | 2019.01.29 |
---|---|
소수 완제품 확률 (0) | 2019.01.29 |
이미지 유사도 검사 (0) | 2019.01.29 |
사람 네트워크2 (0) | 2019.01.29 |
A응실 보급로 / 다이스트라 (0) | 2018.12.18 |
댓글