From a55e18a06f4f725a9caa932049e0b13eabe42320 Mon Sep 17 00:00:00 2001 From: vicfred Date: Sun, 14 Jul 2024 19:39:51 -0700 Subject: [PATCH] ABC360B Vertical Reading --- atcoder/abc360b_vertical_reading.cpp | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 atcoder/abc360b_vertical_reading.cpp diff --git a/atcoder/abc360b_vertical_reading.cpp b/atcoder/abc360b_vertical_reading.cpp new file mode 100644 index 0000000..1607d21 --- /dev/null +++ b/atcoder/abc360b_vertical_reading.cpp @@ -0,0 +1,32 @@ +// Vicfred +// https://atcoder.jp/contests/abc360/tasks/abc360_b +// brute force, implementation +#include +#include +#include +#include + +using namespace std; + +int main() { + string S, T; + cin >> S >> T; + for (int w = 1; w < S.size(); ++w) { + vector cats(w); + for (int i = 0; i < S.size(); i += w) { + for (int j = i; j < i + w; ++j) { + if (j >= S.size()) { + break; + } + cats[j % w] += S[j]; + } + } + set nekos(begin(cats), end(cats)); + if(nekos.count(T)) { + cout << "Yes" << endl; + return 0; + } + } + cout << "No" << endl; + return 0; +}