From f89f071a53392382c5b1f3163c64adcc4ea6241c Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Mon, 19 Oct 2020 21:44:47 +0800 Subject: [PATCH] =?UTF-8?q?P2089=20=E7=83=A4=E9=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R40126151 --- problem/P2089/P2089.cpp | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 problem/P2089/P2089.cpp diff --git a/problem/P2089/P2089.cpp b/problem/P2089/P2089.cpp new file mode 100644 index 00000000..a4dc3571 --- /dev/null +++ b/problem/P2089/P2089.cpp @@ -0,0 +1,59 @@ +#include + +using namespace std; + +int main() { + int x, ans = 0; + cin >> x; + for (int a = 1; a <= 3; a++) { + for (int b = 1; b <= 3; b++) { + for (int c = 1; c <= 3; c++) { + for (int d = 1; d <= 3; d++) { + for (int e = 1; e <= 3; e++) { + for (int f = 1; f <= 3; f++) { + for (int g = 1; g <= 3; g++) { + for (int h = 1; h <= 3; h++) { + for (int i = 1; i <= 3; i++) { + for (int j = 1; j <= 3; j++) { + if (a + b + c + d + e + f + g + h + i + j == x) { + ans++; + } + } + } + } + } + } + } + } + } + } + } + cout << ans << endl; + for (int a = 1; a <= 3; a++) { + for (int b = 1; b <= 3; b++) { + for (int c = 1; c <= 3; c++) { + for (int d = 1; d <= 3; d++) { + for (int e = 1; e <= 3; e++) { + for (int f = 1; f <= 3; f++) { + for (int g = 1; g <= 3; g++) { + for (int h = 1; h <= 3; h++) { + for (int i = 1; i <= 3; i++) { + for (int j = 1; j <= 3; j++) { + if (a + b + c + d + e + f + g + h + i + j == x) { + cout << a << ' ' << b << ' ' << c << ' ' + << d << ' ' << e << ' ' << f << ' ' + << g << ' ' << h << ' ' << i << ' ' + << j << endl; + } + } + } + } + } + } + } + } + } + } + } + return 0; +}