From 06e8fe66060ec6adc5de297295de117ad6a7f3e4 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 7 Aug 2022 14:13:44 +0800 Subject: [PATCH] =?UTF-8?q?T258573=20[Aya=20Round=201=20B]=20=E5=B9=BB?= =?UTF-8?q?=E6=83=B3=E4=B9=A1=E9=BA=BB=E5=B0=86=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/82791696 --- Luogu/T258573/T258573.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Luogu/T258573/T258573.cpp diff --git a/Luogu/T258573/T258573.cpp b/Luogu/T258573/T258573.cpp new file mode 100644 index 00000000..8e0bdbab --- /dev/null +++ b/Luogu/T258573/T258573.cpp @@ -0,0 +1,37 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int t, a[10], p[10]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> t; + + while (t--) { + bool flag = false; + + for (int i = 1; i <= 4; i++) { + cin >> a[i]; + } + + for (a[5] = 0; a[5] <= 9; a[5]++) { + for (int i = 1; i <= 5; i++) { + p[i] = i; + } + + do { + if (a[p[1]] - 1 == a[p[2]] && a[p[2]] == a[p[3]] + 1 && a[p[4]] == a[p[5]]) flag = true; + } while (std::next_permutation(p + 1, p + 1 + 5)); + } + + cout << flag << endl; + } + + return 0; +}