From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- store/works/life/algorithm-experiment/1.1b.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 store/works/life/algorithm-experiment/1.1b.cpp (limited to 'store/works/life/algorithm-experiment/1.1b.cpp') diff --git a/store/works/life/algorithm-experiment/1.1b.cpp b/store/works/life/algorithm-experiment/1.1b.cpp new file mode 100644 index 0000000..c64c73e --- /dev/null +++ b/store/works/life/algorithm-experiment/1.1b.cpp @@ -0,0 +1,20 @@ +#include + +int main() { + for (int i = 2; i <= 1000; i++) { + std::cout << i << ','; + + int n = i; + + int k = 0; + + while (n != 1) { + n = n % 2 ? n * 3 + 1 : n / 2; + k++; + } + + std::cout << k << '\n'; + } + + return 0; +} \ No newline at end of file -- cgit v1.2.3