※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※
이번에 볼 문제는 백준 14368번 문제인 Fashion Police (Large)이다.
문제는 아래 링크를 확인하자.
https://www.acmicpc.net/problem/14368
14368번: Fashion Police (Large)
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is an integer: the maximum number of days you will be able to avoid being taken to Fashion Jail. Then output y more lines, each of whi
www.acmicpc.net
여기서 조금 더 관찰을 해보면
아래는 제출한 소스코드이다.
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T; cin >> T;
for (int t = 1; t <= T; t++) {
int J, P, S, K; cin >> J >> P >> S >> K;
if (K > S) K = S;
cout << "Case #" << t << ": " << J * P * K << '\n';
for (int j = 1; j <= J; j++) {
for (int p = 1; p <= P; p++) {
for (int k = 0; k < K; k++) {
cout << j << ' ' << p << ' ' << (j + p + k - 1) % S + 1 << '\n';
}
}
}
}
}
'BOJ' 카테고리의 다른 글
[BOJ 5489 // C++] Numbers (0) | 2023.05.07 |
---|---|
[BOJ 14367 // C++] Fashion Police (Small) (0) | 2023.05.06 |
[BOJ 14373 // C++] Technobabble (Small) (0) | 2023.05.04 |
[BOJ 14374 // C++] Technobabble (Large) (0) | 2023.05.03 |
[BOJ 14371 // C++] Close Match (Small) (0) | 2023.05.02 |