From 96254947699986c59f0dc63d69fd4b76bd3ed43e Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Jul 2026 19:08:08 +0200 Subject: Initial commit --- 01_introductory_problems/weird_algorithm_1068.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 01_introductory_problems/weird_algorithm_1068.cpp (limited to '01_introductory_problems/weird_algorithm_1068.cpp') diff --git a/01_introductory_problems/weird_algorithm_1068.cpp b/01_introductory_problems/weird_algorithm_1068.cpp new file mode 100644 index 0000000..35cbdfa --- /dev/null +++ b/01_introductory_problems/weird_algorithm_1068.cpp @@ -0,0 +1,12 @@ +#include + +int main() { + long long n; + std::cin >> n; + + while (n != 1) { + std::cout << n << " "; + n = (n % 2) ? n * 3 + 1 : n / 2; + } + std::cout << 1 << std::endl; +} -- cgit v1.3